[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: generic * and 0

From: Kevin Ryde
Subject: Re: generic * and 0
Date: Sat, 02 Dec 2006 08:52:13 +1100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

"Mikael Djurfeldt" <address@hidden> writes:
> If you want to use an operator which is common for numbers and <c>:s,
> why don't you want to use a common zero?  If you don't, the behavior
> of the operator will be inconsistent.

For multiply by 0, I can sort of think of cases when the return type
shouldn't be a fixnum.  If you're doing 0 times a certain size matrix,
then you probably want a matrix full of zeros to come back.  Does that
sound right?

For multiply by 1, I can't actually think of any time you wouldn't
want to get back the object unchanged.  But perhaps if a class has a
notion of multiply, but not "multiply by scalar" then you'd like it to
be overridable so it can be banned.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]