[Glass] Why this closure is not #isSimple ???
Mariano Martinez Peck via Glass
glass at lists.gemtalksystems.com
Fri Nov 6 12:01:23 PST 2015
On Fri, Nov 6, 2015 at 4:51 PM, Martin McClure <
martin.mcclure at gemtalksystems.com> wrote:
> 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.
>
>
Sure, but I am sending the message to the outer block, not the inner block.
> I understand that the outer block's result is somewhat surprising.
>
>
Yes, I think it should be considered a bug because THAT closure (the one I
am sending the message) IS SIMPLE. Right?
> 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.
>
>
Yes, this is the correct behavior I would expect.
Do you know if there is a workaround for 3.2.x ?
Thanks Martin for the explanation.
--
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20151106/fd3ac7b1/attachment.html>
More information about the Glass
mailing list