Object orientation - can you have too much of a good thing?
hmm at heeg.de
Mon Oct 29 19:31:11 UTC 2007
> 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.
Well I for one would not want Smalltalk to behave like that...
> I'm not suggesting anything be changed in Smalltalk; I'm just
> questioning the premise that symmetry is necessary or even desirable.
Since there is quite some agreement in mathematics on the commutativity
of the + operator when applied to scalars, it seems reasonable to
implement it like that in programming languages :-)
In general, designing things such that they don't break assumptions made
by people using them is a good thing. There are cases where it should be
done differently, but you have to have a very good reason to do that.
Questioning the desirability of such "common ground assumptions" is a
good way to start a brainstorming process which can lead to new
insights, but for such a process the context should be made clear. In a
huge mailing list it's much too easy to be mistaken for being a troll :-)
More information about the Squeak-dev