Next: Moscow ML library index
Up: No Title
Previous: The preloaded library units
Moscow ML implements the Core language of Standard ML (revised 1996),
and most of the required parts of the Standard ML Basis Library.
Notable changes from the language of the 1990 Definition include:
- The use of `value polymorphism' in the type checker. This means
that
val x = []
will elaborate, with x having type
'a list, because the expression is non-expansive, but
val x = (fn y => y) []
will not, because the expression is
expansive. - New types char and word, new constants such as
character
#"a"
, decimal word 0w99
, hexadecimal word
0wxF1
, hexadecimal integer 0x99
, and new string
escapes "\a"
. - Functions chr, ord, explode, and implode
produce resp. consume characters, not strings.
- The arithmetic exceptions Abs, Diff, Div,
Exp, Floor, Mod, Neg, Prod, Quot,
and Sum have been replaced by the two exceptions
Overflow and Div, meaning `result too big' and `divisor is
zero'.
- The exceptions Ln and Sqrt have been replaced by a
new exception Domain, meaning `argument outside domain of the
function'.
- The identifier @ associates to the right.
- The resolution of mixed infix operators of the same precedence
has been changed: mixed left-associative operators associate to the
left, mixed right-associative operators associate to the right, and
mixed left- and right-associative operators are illegal. This
permits expressions such as [1] @ 2 :: [3] and 1 :: [2]
@ [3].
- The math functions sin, cos, arctan, ln,
exp, and sqrt are no longer available at the top-level;
they are in structure Math.
- The input/output functions open, input, close,
etc. are no longer available at the top-level; they are in
structures TextIO and BinIO.
- There is a type 'a vector of immutable vectors of
elements, vector expressions #[
![tex2html_wrap_inline1861](img39.gif)
![tex2html_wrap_inline1863](img40.gif)
,
and vector patterns #[ ![tex2html_wrap_inline1867](img42.gif)
![tex2html_wrap_inline1863](img40.gif)
. - There is a type 'a array of mutable arrays.
- There is a large library of utility functions on lists, arrays,
vectors, strings, substrings, paths, file systems, characters,
integers, reals, binary trees, etc.
- Moscow ML supports quotations and antiquotations such as
`record
^
fields end`, and permits installable
pretty-printers. These are non-standard facilities.
Moscow ML has a simple module system, which deviates from
the Standard ML Modules language as follows:
- There are no functors (and hence no sharing constraints), and no
nested structures.
- Signatures may contain type abbreviations. In a signature, no
type, value, or exception constructor may be specified twice at
top-level; a local specification can be used only to restrict
the scope of open specifications and type abbreviations; and
an open specification can appear only inside local.
- Signature constraints are opaque: only the information given in
the signature U.sig can be used when compiling another unit which
uses unit U.
- Each signature must reside in a separate file with suffix `
.sig', and each structure must reside in a separate file with
suffix `.sml'.
Next: Moscow ML library index
Up: No Title
Previous: The preloaded library units
Moscow ML 1.42