4.7.5 The Language structure

weakTyvars

Compatibility option

Structure

Shell.Options.Language

Type

val weakTyvars: bool option

Description

If true, set the use of weak type variables. This option is only relevant to the SML '90 mode, as imperative and weak type variables are no longer in the ML language. It is included for compatibility with the Standard ML of New Jersey compiler (NJSML).

NJSML provides weak type variables. These are similar to imperative type variables but include a weakness value indicated by a number at the start of the identifier:

MLWorks> val v: '1a -> '1a = id;

MLWorks ordinarily treats these as normal type variables, because the Definition of SML does not define them as a separate class:

MLWorks> fun id x = x;
val id : 'a -> 'a = fn
MLWorks> val id1 : '1foo -> '1foo = id;
val id1 : 'a -> 'a = fn
MLWorks>

With weakTyvars set to true, however, ML converts them into imperative type variables:

MLWorks> fun id x = x;
val id : 'a -> 'a = fn
MLWorks> val id1 : '1foo -> '1foo = id;
val id1 : '_a -> '_a = fn
MLWorks>

Note that this does not emulate the full NJSML semantics, but simply allows you to parse New Jersey source using this non-standard notation and provides some similar, standard functionality. Treating NJSML's weak type variables as imperative type variables gives a program using them more chance of being typechecked successfully.


MLWorks Reference Manual (version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker