lith wrote: >> But I think the spirit of dup >> described above is that dup defined in a subclass should initialize it >> using its constructor. > > I'd understand the description in such a way that user should > override > neither #dup not #clone but instead create a #initialize_copy method > to > implement anything class-specific (including a non-shallow copy). > Since > that method is called by #clone and #dup and the frozen/tainted state > could be easily reset, I personally still don't quite understand why > there are two methods. > > > This is exactly the approach I am now following after the various discussions and insights. I just leave dup and clone to keep their *default* behavior intact, so they both end up calling initialize_copy and you don't get some bizarre Frankenstein clone if you were to redefine dup or clone. I am thinking about someone else using my code and what will cause less headache for them in the end. -- Kind Regards, Rajinder Yadav http://DevMentor.org Do Good ~ Share Freely