Ch.4 Overview of SML#

§ 4.1. What is SML#?

SML# is a new programming language in the ML-family, having the following features.

  1. Downward compatibility with Standard ML. SML# can compile all programs that conform to the definition of the Standard ML[4].

  2. Record polymorphism. SML# supports record polymorphism [8]. In SML# , field selection operators #label and record patterns {field-pat,...} are fully polymorphic. This feature is essential in modular development of programs manipulating records, and is the key to extend ML with SQL.

  3. Seamless integration of SQL. SML# seamlessly integrates (currently a subset of) SQL. Instead of providing built-in primitives to access database servers, SML# integrate SQL expressions themselves as polymorphically-typed first-class citizens. This allows the programmer to directly access databases in your polymorphic ML code.

  4. Direct interface to C. SML# programs can directly call C functions of your own coding or in system libraries. The programmer need only declare their names and types, without writing mysterious “stubs” or conversion functions. The SML# generates external references to C functions, which are resolved and linked by the system linker. Both static and dynamic linking are supported.

  5. Separate compilation and linking. SML# supports true separate compilation and linking. By writing an interface file, each source file is compiled separately into an object file in the standard system format (e.g. ELF format.) The separately compiled object files are then linked together possibly with C functions and libraries into an executable program.

  6. Multithread support for multicore CPUs. The non-moving GC [15] and direct C interface allow SML# code to directly call POSIX thread library. As far as the OS thread library support a multicore CPU, SML# program automatically obtains multithread capability for multicore CPUs. With the non-moving fully concurrent GC we have just developed, concurrent threads run efficiently on a multicore CPU.

The SML# compiler and its runtime system are developed at Research Institute of Electrical Communication, Tohoku University. They are open-source software distributed with a BSD-style SML# license (4.5).