Debian Codegraph @

doc/guide/src/StandardMLPortability.adoc

raw
1 = StandardMLPortability
2
3 Technically, SML'97 as defined in the
4 <<DefinitionOfStandardML#,Definition>>
5 requires only a minimal initial basis, which, while including the
6 types `int`, `real`, `char`, and `string`, need have
7 no operations on those base types. Hence, the only observable output
8 of an SML'97 program is termination or raising an exception. Most SML
9 compilers should agree there, to the degree each agrees with the
10 Definition. See <<UnresolvedBugs#>> for MLton's very few corner cases.
11
12 Realistically, a program needs to make use of the
13 <<BasisLibrary#,Basis Library>>.
14 Within the Basis Library, there are numerous places where the behavior
15 is implementation dependent. For a trivial example:
16
17 [source,sml]
18 ----
19 val _ = valOf (Int.maxInt)
20 ----
21
22
23 may either raise the `Option` exception (if
24 `Int.maxInt == NONE`) or may terminate normally. The default
25 Int/Real/Word sizes are the biggest implementation dependent aspect;
26 so, one implementation may raise `Overflow` while another can
27 accommodate the result. Also, maximum array and vector lengths are
28 implementation dependent. Interfacing with the operating system is a
29 bit murky, and implementations surely differ in handling of errors
30 there.