[QUESTION?] Scope (visibility) of variables declared in blocks?

Bob Arning arning at charm.net
Wed Feb 21 23:18:33 UTC 2001


On Wed, 21 Feb 2001 23:54:50 +0100 (CET) Bert Freudenberg <bert at isg.cs.uni-magdeburg.de> wrote:
>On Wed, 21 Feb 2001, Elzbieta Chludzinska wrote:
>
>> When I declare a value within a block:
>> 
>>    [ | tmp | ... ],
>> 
>> shouldn't tmp's visibility be limited to the block in which it was declared?
>> 
>> Shouldn't iterates have a limited visibility as well? For example, in:
>> 
>>    someCollection do: [ :i | ... ]
>> 
>> shouldn't i's visibility be limited to block in which it's the iterate?
>
>Yes it should. This was postponed until someone finally implements
>closures.  Currently the declaration inside a block actually creates
>another method temp, so it's visible outside, too.

Well, that has actually been fixed a bit now. "i" in this case is no longer visible outside the block. Look for change sets with "scope" in the name. There are two in the low 3400's and one in the low 3500's.

Cheers,
Bob





More information about the Squeak-dev mailing list