Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /doc/trunk/src/extensions/extensions.txt
ViewVC logotype

View of /doc/trunk/src/extensions/extensions.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4067 - (download) (annotate)
Mon Jun 8 16:08:15 2015 UTC (4 years, 4 months ago) by jhr
File size: 2884 byte(s)
  minor correction to match sML definition
Standard ML of New Jersey Extensions
====================================
The Fellowship of SML/NJ
{version}, {releasedate}:

The Standard ML of New Jersey (SML/NJ) system implements a number of extensions
to the language as defined by the Definition.

== Module language extensions

=== Higher-order functors

=== Structure constraints for signatures

[source,sml]
------------
structure ASTRUCT :> ASIG where B = BSTRUCT
------------

== Core language extensions

=== Vector expressions and patterns
SML/NJ extends the expression and pattern matching syntax to include support
for vectors of some known size.  The syntax is similar to that of list patterns,
except that the opening bracket has a preceeding ++#++ character.
For example,
[source,sml]
------------
  fun scaleV (s : real, #[x, y, z]) = #[s*x, s*y, s*z]
------------
This extension is always enabled in SML/NJ.

=== Or patterns

_TO BE WRITTEN_

=== Lazy datatypes and functions

_TO BE WRITTEN_

=== Quotation/antiquotation

_TO BE WRITTEN_

== Successor ML extensions

_Successor ML_ (sML) is an effort to continue to grow and improve the SML language.
Andreas Rossberg has defined and implemented an some of the proposed features in
a version of http://www.mpi-sws.org/~rossberg/hamlet[HaMLet].  We are beginning to
implement these features in SML/NJ in coordination with the MLton implementation.

=== Lexical extensions

As of version 110.79, SML/NJ supports the sML lexical extensions.  These can be
enabled using the command-line option ++-Cparser.succ-ml=true++ or the assignment
[source,sml]
------------
  Control.succML := true;
------------
in the REPL.

==== Numeric literals (SML/NJ 110.79)

The syntax of numeric literals is extended in two ways.  First, the underscore
character ("++_++") is now allowed as a separator between digits in a numeric
literal.  For example,
[source,sml]
------------
  123_456
  0wxff_ff_ff_f3
  123_456.1
------------
are valid numeric literals under this extension, but the following are not:
[source,sml]
------------
  123._456		(* underscore not proceeded by digit *)
  0wx_ff_ff_ff_f3	(* leading underscore *)
------------

The second extension is binary literals for both integers and words.  Similar to
hexidecimal literals, the syntax uses a leading "++0b++" to signal a binary
literal.  Examples include
[source,sml]
------------
  0b0101_1110	(* the same value as 0x56 or 86 *)
  0wb1101	(* the same value as 0wD or 13 *)
------------

==== Line comments (SML/NJ 110.79)

This extension adds _line comments_ (__i.e.__, comments that are terminated by
the end of the line) to SML.  These comments are denoted using the character
sequence "++(*)++".  Line comments properly nest into conventional block
comments.  For example, the following block comment is well formed: 

[source,sml]
------------
  (*
  fun f x = x (*) my identity function *)
  *)
------------

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0