Content added Content deleted
(Created page with "The triple script dialect restricts the number of programming constructs that may appear in a module's top-level scope. Aside from definition of the exported clas...") |
m (s/implementation/internals/) |
||
Line 5: | Line 5: | ||
<pre> |
<pre> |
||
export class LineWriter { |
export class LineWriter { |
||
/* ... class |
/* ... class internals omitted for brevity ... */ |
||
} |
} |
||
Revision as of 12:29, 13 May 2022
The triple script dialect restricts the number of programming constructs that may appear in a module's top-level scope. Aside from definition of the exported class (or function, etc.), the only other constructs that may appear are simple static assignments.
A class may benefit from the definition of some enum-like values, for example. Suppose we had a LineWriter
class and we wanted to be able to discriminate between DOS-style line separators and Unix-style newlines.
export class LineWriter { /* ... class internals omitted for brevity ... */ } LineWriter.TYPE_CRLF = 0; LineWriter.TYPE_LF = 1;
The definition of LineWriter.TYPE_CRLF
and LineWriter.TYPE_LF
is valid here, because it's a numeric literal constant, which is one of the permissible forms of static assignment.
NB: Not to be confused with SSA form in compiler IR.