Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / Identifier.adoc
1 Identifier
2 ==========
3
4 In <:StandardML:Standard ML>, there are syntactically two kinds of
5 identifiers.
6
7 * Alphanumeric: starts with a letter or prime (`'`) and is followed by letters, digits, primes and underbars (`_`).
8 +
9 Examples: `abc`, `ABC123`, `Abc_123`, `'a`.
10
11 * Symbolic: a sequence of the following
12 +
13 ----
14 ! % & $ # + - / : < = > ? @ | ~ ` ^ | *
15 ----
16 +
17 Examples: `+=`, `<=`, `>>`, `$`.
18
19 With the exception of `=`, reserved words can not be identifiers.
20
21 There are a number of different classes of identifiers, some of which
22 have additional syntactic rules.
23
24 * Identifiers not starting with a prime.
25 ** value identifier (includes variables and constructors)
26 ** type constructor
27 ** structure identifier
28 ** signature identifier
29 ** functor identifier
30 * Identifiers starting with a prime.
31 ** type variable
32 * Identifiers not starting with a prime and numeric labels (`1`, `2`, ...).
33 ** record label