From: "David A. Black" Date: 2008-09-09T22:11:17+09:00 Subject: Re: "Pointer" to an object? (i.e. reflect changes to origina Hi Brian -- On Tue, 9 Sep 2008, Brian Candler wrote: >> Both lambda and proc work >> as well, incidentally. Actually, from what I've read they're identical >> in 1.8 (which is what I'm using), but not in 1.9, > > Not exactly. I think the statement as written is correct: lambda and proc are the same in 1.8 (with Proc.new being different from both), but in 1.9, lambda is one thing and proc/Proc.new are another (and the same as each other). > * lambda and Proc are different to each other in both ruby1.8 and ruby1.9. > Also, they are different in the same way :-) > > * in ruby1.8, proc {} is a synonym for lambda {} > > * in ruby1.9, proc {} is a synonym for Proc.new {} > > So to play it safe, never use proc {} - always use lambda {} or Proc.new {} The original plan, as of RubyConf 2004, was to deprecate proc entirely. At least, I got Matz to say he would on that occasion :-) I rather wish that had happened. In any case, there's also ->(){} in 1.9 of course.... David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!