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.
2.1.1 Arithmetic
rem
andquot
not bound at top level, not infix- multiple precision of Int types (Int, LargeInt, Int31, Int32, [IntInf])
- new word types, multiple precisions (word8, word31=word, word32)
2.1.2 Characters and Strings
A new character type has been added. Characters are no longer denoted by strings of length one. When you explode a string, you get a list of characters, not single character strings.
Character Literals (#"A")
Functions
explode
andimplode
Character classifiers (e.g.
isAlphaNum
)Turning a character into a string, and vice versa
Substrings
2.1.3 Lists
foldl, foldr
replacefold, revfold
, and their types are different from those offold, revfold
.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)
2.2 Input/Output
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 = () : unit2.2.2. The print function
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]2.3. System Facilities
2.3.2. OS structure in Basis
2.3.3. Posix structure in Basis
exportML
, heap image files,@SMLload
command line parameterQuestion: 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.2.4.2. Useful control flags
Controlling compiler warning messages.