[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Is better to subclass or to add methods to an existing class?
From:       ts <decoux () moulon ! inra ! fr>
Date:       2002-09-20 8:49:31
[Download RAW message or body]

>>>>> "C" == Christoph  <chr_news@gmx.net> writes:

>> ruby -e 'class A < Array; end; a = A.new; b = A.new; p ((a+b).type)'

C> I would bet on an A object.  This behavior is somewhat problematic
C> (see the old  "Subrange of String subclass" thread) but I don't see
C> this as a problem of overloading.

 If you add overloading, you add implicitely a new rule : to resolve a call
 ruby compare 2 classes and select the *best* choice.

 This is not the choice made by ruby in my example because its result is
 Array 

 In short :
   * you have removed coercion
   * you change one rule of ruby

 It's time, for you, to find a name for this new language (try to avoid P
 for the first letter :-))



Guy Decoux
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic