[squeak-dev] Broken scoping in a Workspace

Bob Arning arning315 at comcast.net
Sat Nov 2 13:57:10 UTC 2013


It doesn't see it. Doing the second part only will result in two 
bindings being created: "b" and "value". "value" is never initialized to 
anything so it is nil. If you do only the first part, just one binding 
is created: "a".

Cheers,
Bob


On 11/2/13 6:42 AM, Frank Shearar wrote:
> a := OrderedCollection new.
> (Smalltalk globals instVarNamed: 'declarations')
> keysAndValuesDo: [:key :value |
> a add: value].
>
> b := OrderedCollection new.
> Smalltalk allClassesAndTraitsDo: [:v | b add: value].
> b
>
> Note that value should be scoped only to the first block. That second
> block should _not_ be able to see value. But it can, so (a) the code
> compiles and (b) produces #(nil nil nil ...).
>
> frank
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131102/33db6135/attachment.htm


More information about the Squeak-dev mailing list