From: harryo@... (Harry Ohlsen) Date: 2002-03-31T08:07:34+09:00 Subject: Re: Creating an instance of a class without calling initialize() "Joseph Girgis" wrote in message news:... > Why don't you want the initialize() method? Glad someone finally asked :-). I've been working with Chris Morris's XML serialisation module, which is really nice. However, what it currently requires is that your initialize either takes no parameters or has defaults for everything, so that it can be called with none. What the deserialisation does is something like ... obj = new FOR EACH ATTRIBUTE obj.send("#{attributeName}=", attributeValue) END where the attribute names and values are retrieved from the XML data. However, we've been discussing how this is a bit of a restriction, especially if you're retrofitting the serialisation to a class hierarchy you've already written. What you really want is to bypass any initialize that exists, not force the class designer to make their initialize callable with no parameters. I'd been able to make everything work the way I want, but only by having a separate method in every class that generates a prototype object (ie, it just calls initialize with some valid set of values) and wanted to remove that requirement. The idea about aliasing and then unaliasing initialize should work for me; I really should have thought of that !! I'm also intrigued by the reference to YourClass.allocate() mechanism that's been mentioned as being in 1.7, so I'll look into that. Thanks to everyone for the replies. I just KNEW it could be done in pure Ruby, but wasn't thinking carefully enough !!