From: "John Lam (CLR)" Date: 2007-06-29T06:27:21+09:00 Subject: NilClass, TrueClass, FalseClass special cased for singleton classes? --_000_372109E149E8084D8E6C7D9CFD82E06329CECEF234NAEXMSGC115re_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable If you do: class << nil self end it returns NilClass - this is the case for true and false as well. It appears that this behavior is special-cased for at least these three wel= l-known singleton objects. Two questions: 1) Are there others? 2) Why is this the case - it seems like there was effort to make this = happen vs. no effort to do what Ruby does with 'normal' singleton classes. Thanks, -John --_000_372109E149E8084D8E6C7D9CFD82E06329CECEF234NAEXMSGC115re_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

If you do:

 

class << nil

   self

end

 

it returns NilClass – this is the case for true = and false as well.

 

It appears that this behavior is special-cased for at = least these three well-known singleton objects. Two questions:

 

1)&n= bsp;     Are there others?

2)&n= bsp;     Why is this the case – it seems like there wa= s effort to make this happen vs. no effort to do what Ruby does with ‘n= ormal’ singleton classes.

 

Thanks,

-John

 

--_000_372109E149E8084D8E6C7D9CFD82E06329CECEF234NAEXMSGC115re_--