From: Justin Collins Date: 2006-08-16T07:14:11+09:00 Subject: Re: block equality --------------040705080100070007090400 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Marshall T. Vandegrift wrote: > "Tom Jordan" writes: > > >> Is there a way to compare two blocks with each other? >> >> If you promote a block into a Proc, how would you know that the >> original block was the same? >> > > I haven't dived into the code, but I'm pretty sure that (a) promoting > a block to a Proc via &block in the argument list results in a new > Proc each time and (b) ruby 1.8 provides no introspection into the > actual contents of a block. > > Yes, it's kind of like asking if two equations or two methods are equal. On the other hand, you could probably use the SerializeableProc (developed here: http://rubyquiz.com/quiz38.html), add an equality method, and then you'd have it. :) -Justin --------------040705080100070007090400--