This working release incorporates an alpha versions of a major new feature, and some housekeeping changes.
LazySMLThis release integrates support for Lazy evaluation along the lines of Phil Wadler's proposed "even" style (which was inspired by Chris Okasaki's proposal). The implementation is by Walid Taha.
The basic idea is that a new keyword "lazy" has been added, which is used as an annotation on datatype, val, fun and val rec bindings. The SML/NJ compiler normally treats "lazy" as an identifier, so one must first set the variable Compiler.Control.lazyKW to true. Here some examples:Standard ML of New Jersey, Version 110.1, February 14, 1998 - Compiler.Control.Lazy.enabled := true; val it = () : unit - open Lazy; (* see Caveats below *) opening Lazy datatype 'a susp = $ of 'a - datatype lazy 'a stream = Nil | Cons of 'a * 'a stream; datatype 'a stream_ = Cons_ of 'a * 'a stream_ susp | Nil_ type 'a stream = 'a stream_ susp - fun lazy map f Nil = Nil = | map f (Cons(x, r)) = Cons(f x, map f r); val map_ = fn : ('a -> 'b) -> 'a stream_ susp -> 'b stream_ val map = fn : ('a -> 'b) -> 'a stream -> 'b stream - fun cutoff 0 _ =  = | cutoff n Nil =  = | cutoff n (Cons(x, r)) = x :: cutoff (n-1) r; val cutoff = fn : int -> 'a stream -> 'a list - val rec lazy ones = Cons(1, ones); val ones = $$ : int stream_ susp - cutoff 5 ones; val it = [1,1,1,1,1] : int list
Further informationChris Okasaki's proposal is in his PhD dissertation:http://www.cs.cmu.edu/afs/cs.cmu.edu/project/fox/mosaic/papers/cokasaki-thesis.psPhil Walder's paper on Odd vs. Even styles of lazyness can be found in various formats at:http://www.cs.bell-labs.com/who/wadler/topics/recent.html
CaveatsCurrently there is a bug in the way the lazy features are implemented, which requires that one first open the Lazy structure at top-level before using the "lazy" keword. This bug also means that the lazy features cannot be used with CM. We hope to have this bug fixed in a month or so.
Other changesThe "overload" keyword (formally "_overload") is now handled like the "lazy" keyword. If Compiler.Control.overloadKW is set to false (the default), then it is treated as an identifier. Note that overloading is not supported for general use; it is an internal mechanism used to establish the initial top-level environment.
The top-level structure System (and its substructure Tags) are no more. The Tags structure was replaced by the ObjectDesc structure, which is part of the machine specification. This should make it possible to change the tagging scheme used in the compiler.
The SMLofNJ.Susp structure has been removed, since the LazySML features provide the same mechanism.
The code generator for the "bytecode" target has been removed (this hasn't been supported for a couple of years).
And a few MLRISC infra-structure changes.
- The Alpha and HPPA parallel copy instructions (COPY and FCOPY) contain an additional register allocated temporary that may be used to break cycles. This eliminates one more need for the dedicated assembler temporary.
- With copy-propagation and scheduling done before register allocation, it is no longer true that a spilled register will never be aliased. Thus, the regmap must be passed around to the spill and reload operations in order to rewrite instructions.
- The HPPA branch instructions now have the nullification field.
The DistributionThe 110.2 distribution files are available fromftp://ftp.research.bell-labs.com/dist/smlnj/working/110.2/(with installation instructions here.)