Object orientation - can you have too much of a good thing?

Blake blake at kingdomrpg.com
Mon Oct 29 07:15:09 UTC 2007


On Sun, 28 Oct 2007 22:53:28 -0800, Hans-Martin Mosner <hmm at heeg.de> wrote:

> For the current arithmetic implementation in Smalltalk, yes (in either
> case the integer is converted to a float, and those two floats are
> added. Floating point addition is commutative).

Yes, I know that it is.

> In general, a + b can be unequal to b + a, for example, if you implement
> the #+ method in class String to mean concatenation.
> Even in mathematical notations, there are operator symbols which are
> commutative when used with scalars and non-commutative when used with

Well, and what I'm wondering aloud is whether if you send a plus message  
to an integer you'd want an integer back, and a plus message to a real  
should return a real.

I'm not suggesting anything be changed in Smalltalk; I'm just questioning  
the premise that symmetry is necessary or even desirable.



More information about the Squeak-dev mailing list