On Mon, 21 May 2001, Yukihiro Matsumoto wrote: > |Please see the program listing in [ruby-talk:12558], and: > | 1. Explain why that program works. > Sorry, I don't get your point. The code is: > and because of "Foo.dup", it is not repeated inclusion. You are perfectly right. I forgot about the .dup and the rest was just a big hallucination. > |Not only this piece of code does not find out whether there was already a > |singleton class associated to that object... but, according to page 243 of > |the Pickaxe book, this actually creates a singleton class for the object. > |Which leaves this question doubly unanswered. > Oops... singleton_methods do the job for most of the cases, > unless you really want to know existance of empty singleton > class, which usually can be ignored. Such "empty" singleton classes could be ignored if it weren't for foo.extend Bar, or class<<foo; include Bar; end, isn't it? matju