From: Trans Date: 2005-07-31T02:06:02+09:00 Subject: Re: make local var visible David A. Black wrote: > > That would essentially do away with the notion of a local variable. I > think it's valuable to have them -- really quarantined "scratchpad" > things that just don't overlap between scopes. Writing things that > depend on local variable names from other scopes is pretty fragile. > Would it? Hmm.. I guess I was thinking that if you assigned a vairable in the current scope it would get locked into that scope, and hence be just as local as it ever was (kind of like method vs. local var). foo = 1 p foo def x foo = 2 p foo end x p foo _produces_ 1 2 1 To hang on to the outerscope one would have to "replace" foo instead of assign it. Tough I suppose that'd require a general ability to use #replace on anything (and probably a replace operator like ":="). Nonetheless, doesn't that preserve local vars and yet "open-up" the scopes? (Mind you I'm not neccessarily suggesting this would even be possibile given how Ruby is implemented, but the idea in general seems intriging.) T.