When is a closure a real one? [was: Real closures]

Klaus D. Witzel klaus.witzel at cobss.com
Sun Oct 8 09:43:36 UTC 2006


Hi Mathieu,

on Sun, 08 Oct 2006 11:26:00 +0200, you wrote:
> Klaus D. Witzel a écrit :
>> Thank you Mathieu and Phillipe for you pointers and example.
>>
>> Just out of curiosity (and as input for writing accurate yes/no test
>> cases :) let me ask what is expected by the community (apologies if this
>> sounds like a silly question ;-) when is a closure a real one:
>>
>> 1] after #fixTemps (or equivalent)
>
> no
>>
>> 2] after #blockCopy: (is this equivalent to 1?)
>
> no and it's not equivalent to 1.

And *exactly after* the respective operation? Don't they have the same  
values represented by the same names?

> In fact blockCopy create a BlockContext.

Ah :)

> And a BlockContext is not a closure, it's more like MethodContext.

This is the question that I'm trying to address by using equivalency (not  
identity). A counter example for you: a block with a single argument which  
does *not* access anything else but the argument, always has equivalent  
state and behavior (in terms of what you put inside [:x|...]) and that is  
regardless of 1, 2 or 3.

> See:
> http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_chapter27.html#Contexts27
>
>>
>> 3] after #createBlock: (is this equivalent to 1? to 2?)
>
> Yes and in a way it can be equivalent to 1 plus 2.

In what way, mind to elaborate a bit. Thank you.

/Klaus

>>
>> 4] <put: your requirements: or thoughts: here>
>>
>> Thank you for your time!
>>
>> /Klaus
>>
>
>
>
>





More information about the Squeak-dev mailing list