On Thu, 30 Dec 2010 21:15:30 +0200, Jérôme M. Berger <[email protected]>
wrote:
Andrei Alexandrescu wrote:
Many good examples do prove a ton though. Just off the top of my head:
- complex numbers
Multiplication and division are different from each other and from
addition and subtraction.
- checked integers
- checked floating point numbers
- ranged/constrained numbers
More or less the same case, so I'm not sure that they make three.
Other than that agreed.
- big int
- big float
- matrices and vectors
- dimensional analysis (SI units)
- rational numbers
- fixed-point numbers
For all of those, multiplication and division are different from
each other and from addition and subtraction.
So what your examples do is actually prove *Steven's* point: most
of the time, the code is not shared between operators.
Jerome
First, most of these don't even have a division operator defined in math.
Second, you prove Andrei's point, not the other way around, since it makes
the generic case easier, particular case harder.
--
Using Opera's revolutionary email client: http://www.opera.com/mail/