From: Gary Wright Date: 2011-04-07T05:50:38+09:00 Subject: Re: Proc#== behaviour (from Ruby-Core) On Apr 6, 2011, at 9:11 AM, Adam Prescott wrote: > I've encountered a problem when using Proc#== (with both lambdas and procs) > in my code, where the result does not match up with what the documentation > says. 1.9.2 differs from 1.8.7 in result and in the source code, so that > suggests attention has been given to the method, at least. It was suggested > that ruby-core was the place to go for this. I've run into this issue in the past. One of the issues is that the binding associated with a proc can be different even if the 'source' of the binding is the same. I think that is enough to ensure that the proc's won't be considered equal via ==. You can dup or clone a proc in 1.9.2 to get equivalent procs even though the bindings still aren't equal: l1 =ruby-1.9.2-p180 > l1 = lambda { 1 + 1 } => # ruby-1.9.2-p180 > l2 = lambda { 1 + 1 } => # ruby-1.9.2-p180 > l1 == l2 => false ruby-1.9.2-p180 > l3 = l1.clone => # ruby-1.9.2-p180 > l1 == l3 => true ruby-1.9.2-p180 > l1.binding == l3.binding => false I don't really have a conclusion, just wanted to point out the binding issue and the dup/clone behavior. Gary Wright