On Jun 5, 2007, at 11:48, David Flanagan wrote: > Eric Hodel wrote: >> A proc is more than just its body. > > I understand. My point is that the Proc.== documentation says: > > Return +true+ if _prc_ is the same object as _other_proc_, or if > they are both procs with the same body. > > To me, this implies that you can use == to compare the body of two > separate proc objects. I couldn't come up with any case where you > could actually do this. Nobu pointed out that when two procs have > empty bodies, == works for comparing them, but so far, there are no > other cases in which the documentation matches the implementation. > > I suggest that the implementation is correct and the documentation > is in error. Proc#== works no differently than Object#==. proc {} == proc {} due to an implementation detail. To make this work the way you think it should work you'd need to walk the ASTs and so-forth of each proc. Since we're talking about something implemented in C, I feel that "same" means pointers, not walking ASTs.