Le 14/09/2015 04:17, Richard A. O'Keefe
a écrit :
I also note that Money / Money -> Number (not Money)
and if Money * Money -> something, it certainly isn't Money.
Similarly, DateAndTime ± Duration -> DateAndTime,
and DateAndTime - DateAndTime -> Duration, but
DateAndTime + DateAndTime does not make sense.
(DateAndTime and Duration come from Smalltalk.)
I've chosen these examples because they are not "metaphorical"
overloadings of the operators. They do obey natural axioms.
E.g., now + (now - now) = now, now + (dur*2) = (now+dur)+dur.
(Assuming exact numbers underneath.)
Sounds like multi-parameter typeclasses are going to be vital
for a restructuring of the numeric classes.