Chad Perrin wrote: > On Wed, Mar 21, 2007 at 08:32:37AM +0900, johan556 / gmail.com wrote: >> I have been using the following pattern to implement multiple >> constructors for a class. It is only a variation of the already >> proposed solutions, but by using "instance_eval" I could avoid having >> to create separate new/initialize-like methods for each constructor. > > I've heard it said -- and I tend to agree -- that regular use of > "patterns" is a sign that the language lacks something. I wonder if > that is the case with Ruby, as applies to multiple constructor behavior > implementation. > > I say "wonder" because I really am not certain in this case. Hi Chad! I don't think Ruby "lacks" anything, it's just that it has a different way of doing things. It's a trade-off between the flexibility of a dynamic language and some other things like methods with same name and different parameters (how are you going to distinguish between one method that uses a string and an integer and another one that uses an integer and a hash, if you don't have types defined at the parameter level?). If you want to do things "like Java" or "like C++", then I think you should open your mind and try to do things in a different way, in a rubbish way. Regards, Nando -- Posted via http://www.ruby-forum.com/.