[Glass] Why this closure is not #isSimple ???
Martin McClure via Glass
glass at lists.gemtalksystems.com
Fri Nov 6 11:51:18 PST 2015
On 11/06/2015 11:10 AM, Mariano Martinez Peck via Glass wrote:
> Hi,
>
> '[ :co |
> | d |
> co collect: [ d := 0 ] ]
> ' evaluate isSimple
>
> Answers false and #_cost answers 2 (complex).
> It seems related to the assignment of a temp var (defined inside the
> closure... 'd' in my example) from inside another closure ( [d := 0] in
> my example)
>
> Any idea why? Of course that is a dummy closure that I reduced from my
> original one in order to the have the smaller reproducible closure to
> illustrate my problem.
>
> Thanks in advance,
In 3.2.x, the outer block is not simple because the inner block is not
simple. The inner block is not simple because it accesses a variable
outside of its own scope.
I understand that the outer block's result is somewhat surprising.
In 3.3, the inner block will still not be simple, but the outer block
will be simple independently of whether or not it contains a non-simple
block.
This should be less surprising.
Regards,
-Martin
More information about the Glass
mailing list