SML# - FeatureRank1Polymorphism Diff

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

SML# moderately extends ML polymorphism to rank-1 polymorphism,
which allows type abstraction to be nested in strictly positive positions,
as seen in the following example.
# fun f x y = (x, ref y);
val f = fn : ['a .'a  -> ['b .'b  -> 'a * 'b ref]]
# f 1;
val it = fn : ['a .'a  -> int * 'a ref]

In addition to moderate enhancement of polymorphism, this rank1
polymorphism makes both the type directed compilation of SML# and
the compiled code more  efficient by suppressing redundant type
abstraction and type application.

This extension does not require any changes to the language syntax nor
it introduce any restrictions.
It is achieved by making type abstraction eagerly
and type instantiation lazily.
The interested user should consult the paper:
[[Atsushi Ohori and Nobuaki Yoshida, "Type Inference with Rank 1 Polymorphism for Type-Directed Compilation of ML. Proc. ICFP Conference, ACM Press, September, pages 160 -- 171, 1999."|]].