Joel VanderWerf | 15 May 05:33

Re: Singleton methods on Float and Bignum

Evan Phoenix wrote:
> Is this still true? Is there a real reason to not allow methods 
> singleton methods to be added to Float or Bignum instances?

x = 1.0
def x.foo; end
(1.0).foo   # what should happen here?

Would floats be stored in some kind of table, like symbols, so that the 
last line works? If so, every float returned by a method would have to 
be looked up in the table to get the unique float object. No?

If, OTOH, each float instance, regardless of #==, can respond to 
different methods, then there is a major abstraction leak.

--

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407


Gmane