On Thu, Jan 15, 2009 at 5:54 AM, William James <w_a_x_man / yahoo.com> wrote:

> Can you see that "proc" is shorter than "lambda"?
>
> foo = proc{|x| proc{|y| x+y}}
>    ==>#<Proc:0x02824eb4@(irb):20>
> foo[3][4]
>    ==>7

But also not the same thing on Ruby 1.9, so it's important to be
careful about this generally, even if it works fine with either in the
above example.

>> def foo
>>   proc { return }.call
>>   puts "Never gets printed"
>> end
=> nil
>> foo
=> nil
>> def bar
>>   lambda { return }.call
>>   puts "Gets Printed"
>> end
=> nil
>> bar
Gets Printed
=> nil
>> RUBY_VERSION
=> "1.9.1"



-- 
Technical Blaag at: http://blog.majesticseacreature.com
 Non-tech stuff at: http://metametta.blogspot.com
"Ruby Best Practices"  Book now in O'Reilly Roughcuts:
http://rubybestpractices.com