From: Trans Date: 2005-11-05T06:57:09+09:00 Subject: Re: Some comments on new 1.9 features Domenico De Felice wrote: > Dale Martenson wrote: > > Sorry for the misunderstanding. > > > > I like the "local" and "share" directives. That would make it clear. > > > > Using too many special characters clutter the code and worsen > > readability. > > Yes, something like > > { |a, b| > local a > share b > a = 1 > b = 2 > } > > would look less weird. However it has the problem that in bigger blocks > the programmer would need to read back the top of the block when he > 'forgets' which attributes are local and which shared. They would'nt *have* to be just at the top. You could even do it conditionally, although usage is subtle: x = false a = 1 b = 2 lam1 = lambda { |a, b| a = 2 b = 4 if x share b end } lam2 = lambda { b + 1} lam1.call lam2.call #=> 3 x = true lam1.call lam2.call #=> 5 Closure Magic, yes? T.