Notes on Programming SML/NJ

While I was at Bell Labs, I was involved with the SML/NJ project, a compiler for the language Standard ML.

Included is a set of notes for programming Standard ML of New Jersey. This is very much work in progress, and comments and suggestions are welcome.

From the preface:

The impetus behind these notes was the desire to provide a cohesive description of Standard ML of New Jersey, an interactive compiler and environment for Standard ML. The goal is to end up with a complete user guide to the system, including the libraries, the tools and the extensions, as well as a tutorial on how to write ``real'' applications, centered around the use of the module system and the compilation manager. Other reasons include the desire to provide hands-on examples of how to use some maybe poorly understood features or features with an interface different from what one may be used to. Examples of such features include sockets, the input and output subsystem, the readers approach to text scanning and the use of continuations to handle non-local control-flow. All in all, this would be a repository for snippets of SML and SML/NJ programming lore.

These notes are not a tutorial introduction to Standard ML. There exists excellent introductory material, available both commercially or freely over the Internet. These notes complement this literature by focusing on the Standard ML of New Jersey environment. The first part of these notes does given an overview of the language, but a quick one and without highlighting some of the subtleties of the language. Better writers than I have written better introductory material and I urge you to read those first. References are given in the chapter notes of the introduction. I go in somewhat more details when describing the Basis Library, since some of the underlying ideas are fundamental to the overall programming philosophy. Unfortunately, that chapter is long, boring and reads more like a reference manual than a tutorial. Thoroughness and precision at odds with readability. With luck, enough sample code and tutorial material is interspersed to lighten the mood. In the course of the notes, I take the opportunity to describe more advanced topics typically not covered in introductory material, such as sockets programming, signals handling, continuations, concurrency. Some of these subjects are discussed in advanced programming language courses, which not every one has taken or plan to take. Some of these subjects are hardly discussed and one needs to rummage technical papers or source code.

  • Chapters 1 through 7 (Introduction, Core Language, Module System, Basis Library, Interactive, Compiler, CM, SML/NJ Library), available in Postscript and PDF

Last modified: Thu Sep 2 14:03:00 2004