2007/9/9, dblack / wobblini.net <dblack / wobblini.net>:
> Definitely not a bug. Block parameters use assignment semantics, with
> regard to the scope in which the block appears. In your example,
> you're assigning 1 to a. If you create a local variable inside the
> block, however, it only exists for the duration of the block.
>
> As far as remember, Guy Decoux and I are the only two people who think
> that this makes perfect sense, once you learn it, and should not be
> changed :-)

Now I'm curious: how often do you have use for this feature?  I mean,
if block parameters were locally scoped you just had to punch in one
more assignment to get the same effect like the current version:

def foo
  x=1
  lambda {|a| x=a}
end

Do I miss something?

Kind regards

robert