From: Alexander Schofield Date: 2002-02-26T02:04:14+09:00 Subject: Re: Style Question Ron Jeffries wrote: > So what I've got now is that Sets are created by factory methods such as > Set.create(anArray) > Of course (he said, after finally figuring it out) this means that no > one can do Set.new(anything), because that will implicitly call > initialize and MUST return an instance of Set, which is illegal because > Set is abstract. I guess that's OK with me. Well, I've heard criticism of this before, and it might have been changed for 1.7, but in 1.6 this works fine: irb(main):001:0> class C irb(main):002:1> def C.new irb(main):003:2> [super, 3] irb(main):004:2> end irb(main):005:1> end nil irb(main):006:0> c = C.new [#, 3] > and so on. So my question is, is this good style, and if not, what would > be better? Recall that the clients of Set should never need to know > about any of the concrete classes. I'm not about to give style advice to Ron Jeffries, but http://sourceforge.net/projects/rubycollections might be of interest to you. HTH -- Alexander Schofield