From: Paul Brannan Date: 2002-09-20T01:48:29+09:00 Subject: Re: Is better to subclass or to add methods to an existing class? On Fri, Sep 20, 2002 at 01:20:37AM +0900, William Djaja Tjokroaminata wrote: > Actually, because in Ruby a class definition is never closed, don't we > fundamentally have a similar problem (although possibly with much less > probability, especially when module is used) by subclassing as adding a > method? In other words, the name of subclass that we create may already > be used as a name of some other class. You can create the subclass inside a "namespace", e.g.: module MyProject class String < ::String ... end end You can also create an anonymous subclass: class Foo @@my_string = Class.new(String) end Paul