On Monday 12 March 2001 00:39, GOTO Kentaro wrote: > In message "[ruby-talk:12289] Re: FEATURE REQUEST: 'my' local variables" > > on 01/03/09, Yukihiro Matsumoto <matz / zetabits.com> writes: > >First, I will not introduce "my" as a keyword to Ruby. > > > >I'm thinking of something like > > > > loop {<a, b, c|d, e, f> > > ... > > } > > > >that declares block parameters a, b, c, and new local variables d, e, > >f, effective within the block, regardless of existence of outer > >variables of same names. Shadowing outer variables is allowed but you > >will be warned (it's bad habit anyway). > > May I show yet another syntax? > > loop {|a, b, c; d, e| ... } > > This might have an advantage that the usual form can be seen as a > special case of this form. I have not considerd about possibility of > implementation, sorry. > > -- Gotoken And I have not really been following this thread in detail, except to test out that it "could" be a problem, especially in the cae of multiple Ruby libraries. x = 5; loop { |y| x = 3; x * y } updating y within a block can be useful behavior, but can also cause a "surprise"! :-) Howabout creating a "strict" local using a prefix in front of an alpha (excepting symbols like $) as in _var to mean LOCAL! LOCAL!! LOCCAL!!! as in : x = 5; loop { |y| x = 3; x * y }; puts x ->5 x = 5; loop { |y| _x = 3; _x * y }; puts x -> 3 or, would this be too confusing and or break things? Regards, Kent Starr elderburn / mindspring.com