[QUESTION?] Scope (visibility) of variables declared in blocks?
bert at isg.cs.uni-magdeburg.de
Wed Feb 21 22:54:50 UTC 2001
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.
More information about the Squeak-dev