David,
Just to clarify the below, / in SML97 was defined to have type Real * Real -. Real where Real stands for some type in a set of types that contain the type real but may contain other types that extend or restrict the type real (such as reals with a higher or lower precision than the required type real or maybe complex numbers). Hence SML97 defines that / defaults to type real * real -> real, if there is no information for the type inferrer to determine otherwise.
Have I got that right? As far as I know, none of the extant SML compilers include any sucn extensions or restrictions of the type real.
Regards,
Rob.
On 3 Feb 2026, at 12:38, David Matthews David.Matthews@prolingua.co.uk wrote:
On 03/02/2026 00:07, Jeremy Dawson wrote:
btw - another inconsistency between compilers
- fun square x = x * x;
val square = fn : int -> int
ie Moscow ML assumes int as a sort of default
The default type for an overloaded operator, other than /, is defined to be int, so every compiler ought to treat it that way. The definition is vague on how much context to use in determining overloading. Poly/ML uses the whole "topdec"; other compilers require the overloading to be resolved within the function definition.
David
Poly/ML mailing list -- polyml@lists.polyml.org To unsubscribe send an email to polyml-leave@lists.polyml.org