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

Lex Spoon lex at cc.gatech.edu
Sun Feb 25 17:40:05 UTC 2001


Bob Arning <arning at charm.net> wrote:

> >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.
> 

Yes, but the fix got undone.  At least in 3.0, "[ :i |  ] value: 3.  i"
returns 3.  The problem is that there are now *two* places temps are
looked up, and one of them has the code wrong.

I sent out a patch a little while ago to re-instate the scope
checking.... and then forgot about it.  (Okay, okay, so maybe a bugs and
fixes database would be a good thing after all).  No idea on whether
it's in 3.1.  Let's see....  The attached is untested, but it did the
trick once upon a time.  It should at least give the right idea.


-Lex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scopeCheckFix2-ls.1.cs
Type: application/octet-stream
Size: 470 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20010225/44a4296e/scopeCheckFix2-ls.1.obj


More information about the Squeak-dev mailing list