This section gives an overview of the organization of the SML Basis Library.
The top-level environment consists of those type, exception, and value identifiers that can be used without qualification. These identifiers are called pervasive. For example, the unqualified type int is bound to the type Int.int
and the function length is bound to List.length
. In addition to the pervasive identifiers, the top-level environment also consists of overloaded identifiers (e.g., + and *) and infix definitions. The top-level environment is described in [Top-level environment].
Operations of the various basic types (i.e., bool
, int
, word
, and real
) are all provided by the SML Basis Library. Additional support for computing with real numbers is provided by the Math
and IEEEReal
structures. In addition, implementations may implement multiple different precisions of integers, words, or reals.
The SML Basis Library provides support for basic operations on the standard option
and list
datatypes with the Option
, List
, ListPair
structures.
The SML Basis Library supports of mutable array and immutable vector types. In addition to the array
and vector
type constructors, there are a variety of monomorphic array and vector types. The monomorphic types provide a more compact representation at the cost of less polymorphism. The Library also defines slices of arrays and vectors, which are an abstraction of contiguous subsequences.
Text processing is supported in the form three basic types: char
, string
, and substring
. Strings are immutable vectors of characters and substrings are string slices (in fact, the types string
is just another name for CharVector.vector
and substring
is another name for CharVectorSlice.slice
). The SML Basis Library also provides functions for converting to and from basic types and strings.
The SML Basis Library supports both binary and text input/output (I/O) using a three-level I/O stack. At the lowest level, the PRIM_IO
interface provides unbuffered I/O on abstract readers and writers. The STREAM_IO
interface provides buffering on top of the primitive readers and writers; it also provides a functional input model that supports arbitrary lookahead. The top-level of I/O support is the IMPERATIVE_IO
interface, which supports dynamically bound streams (i.e., one can redirect an imperative I/O stream after it has been opened).
The SML Basis Library provides support for writing portable code that uses common systems services (e.g., directory navigation). The OS
structure collects together support for file system operations (OS.FileSys
), low-level I/O (OS.FileSys
), pathnames (OS.Path
), and process control (OS.Process
). There is also support for time and date manipulations, as well as interval timing.
Network programming using sockets is supported by a collection of optional structures. The Socket
structure collects together the various operations for socket control and I/O. Three structures are provided for socket creation: INetSock
for Internet-domain sockets, UnixSock
for Unix-domain sockets, and GenericSock
for arbitrary sockets. The NetHostDB
, NetProtDB
, and NetServDB
structures provide access to the network database (e.g., for hostname lookup).
The SML Basis Library supports access to additional system services on Unix systems via the optional Unix
and Posix
structures.
The SML Basis Library supports access to additional system services on Microsoft Microsoft Windows systems via the optional Windows
structure.
For an implementation to be compliant with the SML Basis Library specification, it must provide all of the required components. Furthermore, these components must be implemented as defined by specification; extending these interfaces is not permitted.
The following table lists the signatures that every SML implementation is required to provide:
The following table lists the structures that every SML implementation is required to provide:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In addition to the required components, an implementation may choose to provide some optional components. While these components are optional, if present, they must be implemented as defined by specification; extending these interfaces is not permitted.
The following table lists the optional signatures that an SML implementation may choose to provide:
The following table lists the optional structures that an SML implementation may choose to provide:
The following table lists the optional functors that an SML implementation may choose to provide:
|
|
|
Generated April 12, 2004
Last Modified July 18, 2002
Comments to John Reppy.
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2004 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
University Press.
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America). |