SML简介

SML是指Standard Meta-language
ML(Meta-Language)是一门较早的Functional Language,是当时Type
System理论发展到巅峰时期的作品。由于Type
System和定理的机器证明之间的强烈对应性质,ML从设计之初,就主要被广泛用于定理的机器证明领域,而Lisp,则是较为大众化的Functional
Programming language,活跃在AI的各个领域。
ML后来出现了很多方言,例如Caml。
为了结束混乱局面,于是人们开始着手制定ML的标准,标准化后的ML称为Standard ML(SML)
SML的第一个标准是在84-88年制定,90年颁布,《 Definition of Standard ML》, (Milner,
Tofte, Harper, MIT Press, 1990)。称为SML-90
第二个标准是SML 97。 《The Definition of Standard ML (Revised) 》(Milner,
Tofte, Harper, MacQueen, MIT Press, 1997)
SML 97的一个重要特点就是语言规范中加入了SML 基本标准库。
SML 97的三个主要亮点:
1。The elimination of imperative type variables. The role of imperative
type variables in constraining polymorphism in the presence of effects
is now played by the value restriction, which allows the type of a val
binding to be generalized only when the right hand side is an
expression in a restricted form called a value expression. A value
expression is either a constant, a variable, a function expression
(i.e. a lambda expression) or is built from these elements using
products and constructions.
2、The elimination of structure sharing. Type sharing is still
available, and the structure sharing notation remains, but is
interpreted in a weaker sense, as an indirect way of expressing type
sharing. The role of type sharing is restricted somewhat so as not to
conflict with type definitions.
3、The addition of type definitions in signatures. There is also a new
where type notation that allows one to modify an existing signature by
adding definitions for its type components. New forms of datatype
specifications and definitions allow a datatype to be defined to be
the same as an existing datatype.
SML 97标准库的完整文档在这里可以找到
http://www.smlnj.org/doc/basis/index.html
目前关于SML的书比较少,国内唯一可以买到的是一本《ML程序设计教程》。这本书唯一提到SML97的地方是说在写这本书的时候,SML97正在设计中。
国外已出版的SML 97的书也很少,主要有这么两本
1、Paulson's ML for the Working Programmer (2nd edition)
http://www.cl.cam.ac.uk/users/lcp/MLbook/
2、Ullman's Elements of ML Programming (ML97 Edition)
http://www-db.stanford.edu/~ullman/emlp.html
最后推荐一本很classic的文档
《Programming in Standard ML》,Carnegie Mellon大学计算机学院的Robert Harper于2000年秋写的。
http://www.cs.cmu.edu/~rwh/smlbook/offline.pdf
SML目前主要有这么5个实现版本:
1、Standard ML of New Jersey [强烈推荐]
http://www.smlnj.org/index.html
SML/NJ versions 110 and later implement SML '97 plus some extra
features (vector expressions and patterns, OR patterns, withtype in
signatures, higher-order modules).
2、Moscow ML
http://www.dina.kvl.dk/~sestoft/mosml.html
这个是从Caml light演化而来的
3、ML Kit
http://www.it-c.dk/research/mlkit/
The ML Kit implements SML '97 and uses region analysis for memory
management. The module system is implemented using a scheme called
"static interpretation".
4、MLton
http://www.mlton.org/
A whole program compiler for SML '97.
5、PolyML
Versions 4 and later implement SML '97.

此博客中的热门博文

少写代码,多读别人写的代码

在windows下使用llvm+clang

tensorflow distributed runtime初窥