Hi,
In message "[ruby-talk:8399] Re: My first impression of Ruby. Lack of overloading? (long)"
on 00/12/31, Jean Michel <jmichel / schur.institut.math.jussieu.fr> writes:
>Nice concept. Does not this suggest that method + for Numeric
>behave like:
>
> def +(arg)
> if arg_can_be_considered_as_numeric
> do_addition_as_usual
> else
> arg.add_Numeric(self)
> end
> end
>
>rather than the current mechanism with coerce?
It does not work for operators which are not commutative, e.g.,
expornential operator "**" because "self ** arg" may be interpreted as
"arg ** self". If one would like to solve this problem with the
above, she has to prepare something to specify the order of operands.
But it is very thing done by the current mechanism of coerce :-)
Regards,
-- Gotoken