On Thu, 13 Jun 2002 02:02:24 +0900 "Damon" <adamon / mailandnews.com> wrote: > That is: Modifications to a block variable are visible outside of the > block only if explicitly specified using a 'with' cause. > > To put it another way, variables are passed into the block "by value". > Only if specified using a 'with' clause are they passed in "by > reference". > If a variable is passed in "by value" then any changes made to that > variable are restricted to the block; thus we get shadowing for free. Hey, I like it. The brace version isn't quite as pretty, but it's still fine with me: (1..10).each { with{i} |i| a = i*i } How about we extend it to block variables as well: (1..10).each { with{i,a,b} |i| a = i*i b = 10 } "i" and "a" now reference outer variables, b is local. Of course, we could always use a clause to force locality instead: (1..10).each { local{b} |i| a = i*i b = 10 } I do like the idea of having block params and variables be localized/de- localized in the same fashion. Jim