------ art_39450_25916412.1162664316730 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 11/4/06, ara.t.howard / noaa.gov <ara.t.howard / noaa.gov> wrote: > > On Sat, 4 Nov 2006, Robert Dober wrote: > > > Hi all > > > > Recently we had a thread where we talked about redefining a class. > > The usefuleness of that did not come into my mind before. > > > > Does somebody know a way to redefine a class (without the "already > > initialized constant <ClassName>" warning)? > > And if there is none, which I suspect, might it not be nice to have one? > > > c lass.new{ > def initialize > @x foo' > end > } > o .new > > c lass.new{ > def initialize > @x bar' > end > } > o .new > > ;-) > > > -a > -- > my religion is very simple. my religion is kindness. -- the dalai lama > > Actually I am very disappointed that you cannot read my mind Ara ;) it would be quite antipols to use not constant classnames (wouldn't be there some warnings too BTW?) class C... Css.new... works fine save for the warning I would like to get around Here go some ideas: (1) ruby does not insult you for constant redefinition if you assign a reference to Class (arrrghh bad dangerous) (2) allow an explicit syntax for redefining a class (2.a) class A < B *always* redefines the class Pro: Some Gurus expect this behavior anyway :) Cons: Quite implicit (2.b) new class A Pro: Quite POLS and readable Cons: "new" overloaded maybe use "redefine class A" (3) some meta thingies (3.a) const_set does not warn anymore (3.b) Matz gives us a const_undefine for Christmas ;) Ok what you think? Robert -- The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. - George Bernard Shaw ------ art_39450_25916412.1162664316730--