This section lists some deviations of SML/NJ from The Definition of Standard ML. Some of these are documented in the SML '97 Conversion Guide. Since MLton does not implement these features, if your program contains any of them it will not compile under MLton. If you discover other deviations of SML/NJ that affect compilation under MLton, please send mail to MLton@sourcelight.com.
val op = = 13This is explicitly forbidden on page 5 of the Definition.
val v = #[1,2,3] val #[x,y,z] = v
datatype foo = Foo of int | Bar of int val (Foo x | Bar x) = Foo 13
signature SIG = sig type t = int * int type u = int * int sharing type t = u endThese are disallowed by rule 78 of the definition.
signature S = sig type t type u type v sharing type t = u and type u = v end
type u = real datatype a = A of t | B of u withtype u = int and t = uAccording to the Definition, it should be expanded to the following.
type u = real datatype a = A of u | B of intHowever, SML/NJ expands withtype bindings sequentially, meaning that earlier bindings are expanded within later ones. Hence, the above program is expanded to the following.
type u = real datatype a = A of int | B of int
structure S = struct type t = int end signature SIG = sig structure T : sig type t end end where T = SThis is equivalent to:
structure S = struct type t = int end signature SIG = sig structure T : sig type t end end where type T.t = S.t