From: Olivier Nenert Date: 2003-08-21T06:00:12+09:00 Subject: Re: for/in loop hi Hal, I think kurt was asking "which one of the two scenarios would be fixed by a new scoping rule ?" not "what do you mean by it would work ?" It's an exelent question I think, when the new scoping rule is introduced, either y will be visible outside the each scope, or the x will stop being visible ouside the for loop, I wonder too, surely Matz knows so well what he talks about it was obvious to him, but it isn't to me (and Kurt I guess) :) Cheers, Olivier. (thanx for your posts btw, I'm just starting to read about ruby and found your posts to be the most helpful so far) > ----- Original Message ----- > From: "Kurt M. Dresner" > To: "ruby-talk ML" > Sent: Wednesday, August 20, 2003 1:07 PM > Subject: Re: for/in loop > > >> What do you mean by it would work? The first one will raise a >> NameError, or the second one will output 3 ? > > I think it's a minor problem with Matz's English. I believe he > means "it will work when the new scoping rule is introduced" or > "it would work, if the new scoping rule were already in place." > > Hal > > >> -Kurt >> >> On Thu, Aug 21, 2003 at 01:56:44AM +0900, Yukihiro Matsumoto wrote: >> > Hi, >> > >> > In message "Re: for/in loop" >> > on 03/08/21, Paul Brannan writes: >> > >> > |It's definitely not pointless: >> > | >> > | for i in [1, 2, 3] >> > | x = i >> > | end >> > | p x #=> 3 >> > | >> > | [1, 2, 3].each do >> > | y = i >> > | end >> > | p y #=> test.rb:9: undefined local variable or method `y' for > # (NameError) >> > >> > Yes, but it would work, when new scoping rule is introduced. >> > >> > matz. >> > >> >======= End of Original Message =======< >> > > > > -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/