From: "Mauricio Fernández" Date: 2004-09-14T20:40:52+09:00 Subject: Re: Singleton method on object via define_method? On Tue, Sep 14, 2004 at 07:43:06PM +0900, David A. Black wrote: > Hi -- > > On Tue, 14 Sep 2004, Mauricio Fern�ndez wrote: > > > On Tue, Sep 14, 2004 at 05:34:54PM +0900, Robert Klemme wrote: > > > .... but it might be a good reason to call it "virtual": it simply doesn't > > > exist the whole time. :-) OTOH, you can't tell from the outside - it's > > > there when you need it - lazyly initialized... ("lazy_class"? Oh no...) > > > > There's at least one case where you can know if the singleton class has > > been created or not (singletons of singletons). > > Can you elaborate and/or give an example of what you mean? See my other response to Robert's post. The reason is in rb_make_metaclass: if (BUILTIN_TYPE(obj) == T_CLASS && FL_TEST(obj, FL_SINGLETON)) { RBASIC(klass)->klass = klass; RCLASS(klass)->super = RBASIC(rb_class_real(RCLASS(obj)->super))->klass; } -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com