SML90
structureThe SML90 structure provides the types and values available in older versions of SML. This allows code written under the old basis to be used with little or no change.
The required identifiers correspond to those specified in the Definition as part of the initial basis for which the equivalent is not provided in the new basis. Thus, since the map
function is the same in both the old and new bases, it is not included in SML90. The real type is the exception to this rule. In the old basis, real
was an equality type and allowed pattern matching. In addition, the basic arithmetic operators raised exceptions on exceptional conditions. These properties no longer hold, and the SML90 structure does not provide support for them.
In addition to the required identifiers, the structure may contain implementation-dependent substructures that provide the top-level bindings available in older versions of the implementation. For example, the SML90 might contain the substructure SMLNJ
, which would contain the additional types, values and modules provided by the SML/NJ implementation.
This module is provided solely to allow programmers to continue to run old code in the new environment while, it is hoped, gradually rewriting the source to be compatible with the new environment. At some point, the SML90 structure will be considered obsolete and will be removed from the basis.
structure SML90
:> SML90
signature SML90
type instream
type outstream
exception Abs
exception Quot
exception Prod
exception Neg
exception Sum
exception Diff
exception Floor
exception Exp
exception Sqrt
exception Ln
exception Ord
exception Mod
exception Io of string
exception Interrupt
val sqrt : real -> real
val exp : real -> real
val ln : real -> real
val sin : real -> real
val cos : real -> real
val arctan : real -> real
val ord : string -> int
val chr : int -> string
val explode : string -> string list
val implode : string list -> string
val std_in : instream
val open_in : string -> instream
val input : (instream * int) -> string
val lookahead : instream -> string
val close_in : instream -> unit
val end_of_stream : instream -> bool
val std_out : outstream
val open_out : string -> outstream
val output : (outstream * string) -> unit
val close_out : outstream -> unit
type instream
type outstream
exception Abs
exception Quot
exception Prod
exception Neg
exception Sum
exception Diff
exception Floor
exception Exp
exception Sqrt
exception Ln
exception Ord
exception Mod
exception Io
exception Interrupt
sqrt r
exp r
ln r
sin r
cos r
arctan r
ord s
chr i
explode s
implode l
std_in
open_in s
input (ins, i)
lookahead ins
close_in ins
end_of_stream ins
std_out
open_out s
output (outs, s)
close_out outs
Since the I/O streams here and in TextIO are buffered, but may share low-level I/O primitives, mixing the use of both types of streams in an application may lead to unexpected results.
As noted above, this module only contains items not available in the new basis, or having different semantics. The following list gives the types that are the same in both the old and new bases.
eqtype unit
|
eqtype int
|
eqtype real
|
eqtype string
|
type exn
|
eqtype 'a ref
|
datatype bool = false | true
|
datatype 'a list = nil | :: of ('a * 'a list)
|
exception Bind
|
exception Chr
|
exception Div
|
exception Match
|
val map : ('a -> 'b) -> 'a list -> 'b list |
val rev : 'a list -> 'a list |
val not : bool -> bool |
val ~ : num -> num |
val abs : num -> num |
val floor : real -> int |
val real : int -> real |
val size : string -> int |
val ! : 'a ref -> 'a |
val ref : 'a -> 'a ref |
val / : real * real -> real |
val div : int * int -> int |
val mod : int * int -> int |
val * : num * num -> num |
val + : num * num -> num |
val - : num * num -> num |
val ^ : string * string -> string |
val @ : ('a list * 'a list) -> 'a list |
val = : 'a * 'a -> bool |
val <> : 'a * 'a -> bool |
val < : num * num -> bool |
val > : num * num -> bool |
val <= : num * num -> bool |
val >= : num * num -> bool |
val := : 'a ref * 'a -> unit |
val o : ('a -> 'b) * ('c -> 'a) -> 'c -> 'b |
int
and real
. The actual functions in the new basis have more extended schemas. For example, <
is defined for string
values as well as all varieties of integer
, word
and real
. Additional information on these top-level types and values can be found in the Chapter 3.
Last Modified October 31, 1997
Comments to John Reppy.
Copyright © 1997 Bell Labs, Lucent Technologies