From: Ryan Dlugosz Date: 2003-08-13T02:48:24+09:00 Subject: Re: common constructor idioms Scott Thompson said: > Though there are bound to be differing opinions on the subject (and I > have no desire to start a flame war so please be kind) I was curious to > know is a popular idiom in Ruby code or not? More to the point, would > someone who was using an Ruby extension reasonably assume that this > initialization mechanism was included? That would work, but I'd suspect that it isn't popular around these parts. I would also suggest that it's probably *not* safe to assume that type of initialization system is included with any given extension... It would be a much clearer implementation to specifically define a deep_copy method in your class, a la: def deep_copy Marshal.load(Marshal.dump(self)) end Of course, if you don't need a deep copy, you've already got Object.clone... someone smack me if I'm way off base here. :) -Ryan -- Ryan Dlugosz ryan@dlugosz.net http://dlugosz.net