|
|
|
|
|
by blubb
5960 days ago
|
|
There is no special block or lambda type in Ruby, AFAIK there is just proc and method. The difference is simple, a method is a proc that will be evaluated in the context of its object. I don't know why you're having a problem passing around foo = lambda {|x,y,z| x+y+z }. I admit that having to explicitly call a proc using .call or .[] is less pretty than the python equivalent, but it's hardly a big problem. Having used both Python and Ruby extensively I've concluded that both languages are very nice and usable. They both have their warts and shortcomings, but after Python added closures I really haven't had many "darn, I hate [Ruby|Python] because of shortcoming X". Edit: As noted elsewhere, there IS in fact a difference between Proc.new and lambda/proc, Though I've personally never used Proc.new. |
|