From: Daniel DeLorme Date: 2008-09-30T09:14:24+09:00 Subject: Re: ruby1.9 block scope namekuseijin wrote: > On Sep 29, 12:23 pm, Daniel DeLorme wrote: >> Yukihiro Matsumoto wrote: >>> My vague idea for the issue is that when you see the reference to a >>> local variable inside of the block, the scope of the variable would be >>> upgraded to the level of the reference. >> Do you mean upgrade the scope of the variable dynamically? Is that even >> possible? I thought that all local vars had their scope pretty much set >> in stone at the lexical level. But if you could upgrade their scoping >> level dynamically... that would be nifty indeed! > > Yeah, that would be so... 1970's! > > Even javascript seems to finally have abandoned dynamic scoping in > favor of friggin' *ALGOL*'s lexical scoping... I wonder why would ruby > insist on sloppy programming by opening this old can of worms... Hehe, you have somewhat of a point. Local variables and proper isolation of scope are pretty important to structured programming. But we weren't talking about a free-for-all opening of all scopes, just about the scope of local variables within *blocks*. I wouldn't much like my method-local variables to creep into the global scope just because I forgot to define them with "var", no thank you. -- Daniel