Urabe Shyouhei wrote: > Meinrad Recheis wrote: >>> I don't think so. Nil is _the_ nil, one and only instance of NilClass. >>> Duping it doesn't make sense to me. And a dup method to return >>> identical object is just strange. >>> >> it makes sense to me, to implement dup on singleton objects like nil to >> implement deep copying of arrays and hashes. >> > > Marshal.load(Marshal.dump(obj)) and you get a deep copy of obj. This is > a well known idiom. Any other chances for you to need a dup of nil? > Marshal.load(Marshal.dump(obj)) is far more expensive than a well-crafted #dup method and less semantically controllable. Kurt Stephens