Hi --

ts <decoux / moulon.inra.fr> writes:

> >>>>> "D" == David Alan Black <dblack / wobblini.net> writes:
> 
> D>    def call_foo
> D>      a = lambda {|b| c = b}
> D>      puts c                # error
> D>    end
> 
>  You want to say that this will give an error
> 
>       def foo(x)
>       end
> 
>       def call_foo
>          foo(lambda {|b| c = b})
>          puts c                  # error
>       end
> 
>  and this not ?
> 
>       def foo(x)
>          x.call(24)
>       end
> 
>       def call_foo
>          foo(lambda {|b| c = b})
>          puts c                  # 24
>       end

Yes, that's my interpretation.  The other possibility, I think, is
that c would be nil in the first example, similar to the familiar case
of:

  if false; a = 1; end
  p a                  # nil


That may be what will happen: 

  l = lambda { a = 1 }
  p a                    # nil (not error)

though I find that also to be strange behavior for a closure.  

(Of course, I'm one of the few who think the way block variables work
pre-2.0 is fine, but that's another story :-)


David

-- 
David A. Black
dblack / wobblini.net