The primary goal of this document is to help current SML programmers learn to use SML '97, and to help them convert old SML code to SML '97. It concentrates on changes in the language and libraries, and assumes some familiarity with SML. However, it should also be of some use to new SML programmers, as a supplement to one of the available textbooks or tutorials.
The new SML '97 language itself is defined in The Definition of Standard ML (Revised). Appendix G of that book briefly summarizes the language changes, mainly from the point of view of the language semantics. The treatment here expands on that description, taking the point of view of a programmer. Note that the second editions of Paulson's and Ullman's books describe SML '97.
The other major changes are encompassed in an extensive new Basis library that replaces the minimal initial basis described in Appendices C and D of the original Definition (also known as SML 90).
[See appendix G of the new Definition]
val rec" syntax.
whereclause for structure definitions
Probably the preponderance of the effort of porting code to SML '97 involves updating references to identifiers from the top level environment and other references to the built-in Basis library. The Basis Library is documented separately, but we will cover some highlights of the changes in this section.
The SML/NJ Library has also been updated. New documentation for the SML/NJ Library is in preparation, but there is a SML/NJ Library Porting Guide that gives a module-level summary of the changes relative to the 0.3beta version of 1994. It lists name changes, deletions, and additions in the library relative to the 0.3beta release from 1994. This Porting Guide is also found in the smlnj-lib source directory in the file named PORTING. For documentation of the library signatures, see the comments in the source files for the various signature modules (e.g. src/smlnj-lib/Util/hash-table-sig.sml).
For a concise summary of changes in the top level environment, see the Top Level Environment Comparison page.
quotnot bound at top level, not infix
Character classifiers (e.g.
Turning a character into a string, and vice versa
fold, revfold, and their types are different from those of
A bunch of new functions.
Some functions that were bound at top-level are not in SML '97. (exists)
ListPair structure (zip, unzip, map, app)
outstream => TextIO.outstream instream => TextIO.instream input => TextIO.inputN output => TextIO.output std_out => TextIO.stdOut std_in => TextIO.stdIn
- TextIO.output(TextIO.stdOut, "abc\n"); abc val it = () : unit -
val print : string -> unitNot overloaded now. Still bound at top level.
print 3 => print(Int.toString 3) print 3.0 => print(Real.toString 3.0)[see TextIO structure, IMPERATIVE_IO signature]
use : string -> unit
Compiler.Interact.useStream : TextIO.instream -> unit
exportML, heap image files,
@SMLloadcommand line parameter
Question: Calling the function exportML, as in- SMLofNJ.exportML "image";creates a file called "image.mipseb-irix" that is not executable, while with SML/NJ 93 I would get an executable file called "image". I wonder if I am doing the export correctly or if there is a new procedure for using the exported image?
Answer: The file "image.mipseb-irix" is a heap image -- not an executable. You can load it as follows:% sml @SMLload=imageNote that you do not need to specify the ".mipseb-irix" suffix when specifying the image file, it will be inferred.