Hi,

def f_ok(node)
  func = lambda {|n| p(:in_lambda, n); n }
  p node, func.call(node[:xpto]), node
end

> f_ok({:xpto => "ohoh"})
:in_lambda
"ohoh"
{:xpto=>"ohoh"}
"ohoh"
{:xpto=>"ohoh"}

def f_ko(node)
  func = lambda {|node| p(:in_lambda, node); node }
  p node, func.call(node[:xpto]), node
end

> f_ko({:xpto => "ohoh"})
:in_lambda
"ohoh"
{:xpto=>"ohoh"}
"ohoh"
"ohoh" # ohoh... should be {:xpto=>"ohoh"}, or not??

I can't get any kind of explanation for this. Does anybody have one?
Why "node" in lambda isn't shadowed correctly (as i expected, at least)?
Well "node" is shadowed correctly but seems to be producing side
effects...

Thanks,
Vasco Andrade e Silva
-- 
Posted via http://www.ruby-forum.com/.