[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: "Christoph" <chr_news () gmx ! net>
Date: 2002-09-20 8:41:29
[Download RAW message or body]
"ts" wrote
....
> No, no. I've just added modules to kill it :-)
>
> Another example, what do you expect with ?
>
> ruby -e 'class A < Array; end; a = A.new; b = A.new; p ((a+b).type)'
I would bet on an A object. This behavior is somewhat problematic
(see the old "Subrange of String subclass" thread) but I don't see
this as a problem of overloading.
Anyway I don't think that ``general method overloading'', with
the possible exception of operators, is a good idea anyway.
Rather, the request of an ``overloaded method call'' should be
made explicit - as in
<(a,b)>.foo( _not, *overloaded)
or
a.foo( b; also, _not, overloaded)
/Christoph
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic