[squeak-dev] Re: Serious bug in 3.10
Ramon Leon
ramon.leon at allresnet.com
Fri Aug 1 06:23:33 UTC 2008
> >
> > And you'll see that likely, to:do: is being inlined by the
> compiler and
> > causing something funny like allowing you to increment the
> loops index var
> > causing it to skip a number each iteration.
> >
> > Ramon Leon
> > http://onsmalltalk.com
> >
> >
>
> Yes but:
>
> block := [:f | Transcript cr; show: f].
> (1 to: 10) do: [:f | block value: f+1. block value: f].
>
> does not behave much better...
> the 10 loops are performed, but since the blocks share same
> temporary f, things
> are still a bit strange.
>
> You need to use different argument names, NewCompiler or
> Eliot's closures.
Oh I agree, I wasn't suggesting a solution, I know the scope of the args is
shared because of the lack of real closures. I was more inquiring why the
behavioral difference between (to:) do: and to:do: since the latter is
inlined but normally you'd expect them to be equivalent.
Ramon Leon
http://onsmalltalk.com
More information about the Squeak-dev
mailing list
|