HaloO Darren Duncan wrote:
Up front, I will say that, all this stuff about 1 vs 1.0 won't matter at all if the Int type is an actual subset of the Num type (but whose implementation is system-recognized and optimized), meaning that Int and Num are not disjoint, as "most folks" usually expect to be the case, such that, eg, 1 === 1.0 returns true.
I agree to that except for the last statement. I think that 1 === 1.0 should be False because the involved types are different. This e.g. also applies to 1.0 === Complex(1.0,0.0) which should be False. In both cases we should have numeric equality, i.e. 1 == 1.0 and 1.0 == Complex(1.0,0.0) are True. And of course we have the subtyping chain Int <: Num <: Complex. The Gaussian integers are a subtype of Complex and a supertype of Int but not of Num. So in the end we have the type lattice Complex / \ Num Gaussian \ / Int It's interesting how this Gaussian type might be fitted in after the other three. The link from Int to Gaussian needs a supertyping construct. Something like 'role Gaussian does Complex superdoes Int'. So consider this as an addendum to the supertyping thread. Regards, TSa. --