Int | Int2.int, Int3.int, ... Int32.int, Int64.int, LargeInt.int, IntInf.int |
Real | Real32.real, Real64.real, LargeReal.real |
Word | Word2.word, Word3.word, ... Word32.word, Word64.int, LargeWord.word |
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.
Int | Int32.int |
Real | Real64.real |
Word | Word64.word |
Other implementations may use a smaller context or different default types.
Also see
Examples
-
The following program is rejected.
structure S: sig val x: Word8.word end = struct val x = 0w0 end
The smallest enclosing structure declaration for 0w0 is val x = 0w0. Hence, 0w0 receives the default type for words, which is Word32.word.