From: WATARU Inamori Date: 2003-02-16T20:14:03+09:00 Subject: Re: Local variables & blocks ----- Original Message ----- From: "Jim Weirich" To: "ruby-talk ML" Sent: Tuesday, February 04, 2003 9:39 PM Subject: Re: Local variables & blocks > On Tue, 2003-02-04 at 05:01, Pit Capitain wrote: > > Hi Jim, > > > > thanks for the weird Y fun :-) > > > > Isn't your weird the same as > > > > def weird > > x = nil > > [proc {x}, proc {|v| x=v}] > > end > > > > and wouldn't this work under the new rules, too? > > Yes, it is the same. While thinking about the proposed rules for block > and local scope, I was just struck by the weird symmetry between {x} and > {|x|}. > > And while we have mentioned the new scoping rules, I think the new > rules are fine. They are simplier and more regular than the existing > rules. Its a little odd to declare block local varaibles using the > "local" trick, but then it kinda neat that the language can handle that > as well without any special rules. > > -- > -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich > --------------------------------------------------------------------- > "Beware of bugs in the above code; I have only proved it correct, > not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) >