Hi --

On Mon, 21 Jul 2008, Nasir Khan wrote:

> I write a lot of hand crafted dup or clone because I want control as well as
> better performance than the Marshal idiom. I ended up re-opening NilClass,
> TrueClass and FalseClass for def dup; self; end
> While most of the things in Ruby are very intuitive and predictable from
> functional perspective, this sort of stood out.. that's all.

I understand not wanting true.dup etc. to break things, but it's hard
for me to get past the fact that true.dup doesn't return a dup of
true, if it's defined to return true. Maybe it's a case for a
"dangerous" dup:

   class Object
     def dup!
       dup
     rescue TypeError
       self
     end
   end


David

-- 
Rails training from David A. Black and Ruby Power and Light:
     Intro to Ruby on Rails  July 21-24      Edison, NJ
  *  Advancing With Rails    August 18-21    Edison, NJ
  * Co-taught by D.A. Black and Erik Kastner
See http://www.rubypal.com for details and updates!