MLton 20070826 Overloading
Home  Index  
In Standard ML, constants (like 13, 0w13, 13.0) are overloaded, meaning that they can denote a constant of the appropriate type as determined by context. SML defines the overloading classes Int, Real, and Word, which denote the sets of types that integer, real, and word constants may take on. In MLton, these are defined as follows.

The Definition allows flexibility in how much context is used to resolve overloading. It says that the context is no larger than the smallest enclosing structure-level declaration, but that an implementation may require that a smaller context determines the type. MLton uses the largest possible context allowed by SML in resolving overloading. If the type of a constant is not determined by context, then it takes on a default type. In MLton, these are defined as follows.

Other implementations may use a smaller context or different default types.

Also see

Examples


Last edited on 2007-08-15 22:07:01 by MatthewFluet.