| 1 |
= Unicode |
| 2 |
|
| 3 |
== Support in The Definition of Standard ML |
| 4 |
|
| 5 |
There is no real support for Unicode in the |
| 6 |
<<DefinitionOfStandardML#,Definition>>; there are only a few throw-away |
| 7 |
sentences along the lines of "the characters with numbers 0 to 127 |
| 8 |
coincide with the ASCII character set." |
| 9 |
|
| 10 |
== Support in The Standard ML Basis Library |
| 11 |
|
| 12 |
Neither is there real support for Unicode in the <<BasisLibrary#,Basis |
| 13 |
Library>>. The general consensus (which includes the opinions of the |
| 14 |
editors of the Basis Library) is that the `WideChar` and `WideString` |
| 15 |
structures are insufficient for the purposes of Unicode. There is no |
| 16 |
`LargeChar` structure, which in itself is a deficiency, since a |
| 17 |
programmer can not program against the largest supported character |
| 18 |
size. |
| 19 |
|
| 20 |
== Current Support in MLton |
| 21 |
|
| 22 |
MLton, as a minor extension over the Definition, supports UTF-8 byte |
| 23 |
sequences in text constants. This feature enables "UTF-8 convenience" |
| 24 |
(but not comprehensive Unicode support); in particular, it allows one |
| 25 |
to copy text from a browser and paste it into a string constant in an |
| 26 |
editor and, furthermore, if the string is printed to a terminal, then |
| 27 |
will (typically) appear as the original text. See the |
| 28 |
<<SuccessorML#ExtendedTextConsts,extended text constants feature of |
| 29 |
Successor ML>> for more details. |
| 30 |
|
| 31 |
MLton, also as a minor extension over the Definition, supports |
| 32 |
`\Uxxxxxxxx` numeric escapes in text constants and has preliminary |
| 33 |
internal support for 16- and 32-bit characters and strings. |
| 34 |
|
| 35 |
MLton provides `WideChar` and `WideString` structures, corresponding |
| 36 |
to 32-bit characters and strings, respectively. |
| 37 |
|
| 38 |
== Questions and Discussions |
| 39 |
|
| 40 |
There are periodic flurries of questions and discussion about Unicode |
| 41 |
in MLton/SML. In December 2004, there was a discussion that led to |
| 42 |
some seemingly sound design decisions. The discussion started at: |
| 43 |
|
| 44 |
* http://www.mlton.org/pipermail/mlton/2004-December/026396.html |
| 45 |
|
| 46 |
There is a good summary of points at: |
| 47 |
|
| 48 |
* http://www.mlton.org/pipermail/mlton/2004-December/026440.html |
| 49 |
|
| 50 |
In November 2005, there was a followup discussion and the beginning of |
| 51 |
some coding. |
| 52 |
|
| 53 |
* http://www.mlton.org/pipermail/mlton/2005-November/028300.html |
| 54 |
|
| 55 |
== Also see |
| 56 |
|
| 57 |
The <<fxp#>> XML parser has some support for dealing with Unicode |
| 58 |
documents. |