From: Dave Thomas Date: 2001-10-30T15:07:43+09:00 Subject: [ruby-talk:23808] Re: ref. constructors and new (was: Re: class Foo does not call Class.new?) matz@ruby-lang.org (Yukihiro Matsumoto) writes: > But things are not simple as they appear. Suppose we call String.new > for string literals, > > def String.new(str) > StringSubclass.new(str) > end > > would cause infinite loop, and I don't think there's no easy work > around for it. I don't believe the meta-strings subclass String, so I don't think the loop would occur: def String.new(str) s = self.allocate(str) MetaString.new(s) end Of course there's the problem with the return value from #initialize too... :) All in all, I think this whole thing is a tad dangerous: it's just fun to try to find ways of making even literals dynamic. Regards Dave