2017-05-18 20:38:28 +02:00
|
|
|
# Lumi JavaScript (LumiJS)
|
2017-01-17 20:42:49 +01:00
|
|
|
|
2017-05-18 20:38:28 +02:00
|
|
|
LumiJS is a superset of a JavaScript (ECMAScript) subset. First, take a subset of JavaScript, and then superset it with
|
2017-01-17 20:42:49 +01:00
|
|
|
optional typing annotations (using TypeScript's syntax and semantics for them).
|
|
|
|
|
|
|
|
## Modules
|
|
|
|
|
2017-05-18 20:38:28 +02:00
|
|
|
LumiJS uses ES6-style modules.
|
2017-01-17 20:42:49 +01:00
|
|
|
|
|
|
|
An [ES6 module is a special kind of script](http://www.ecma-international.org/ecma-262/6.0/#sec-scripts-and-modules),
|
2017-05-18 20:38:28 +02:00
|
|
|
which is just a file containing a list of top-level statements. LumiIL modules have a bit more structure to them to
|
|
|
|
facilitate analysis and determinism. As a result, there is a mapping from LumiJS to LumiIL module structure.
|
2017-01-17 20:42:49 +01:00
|
|
|
|
|
|
|
The mapping simply records all declarations -- variables and functions -- and then moves all other statements into the
|
|
|
|
special module initializer (`.init`) function. In the case of blueprints, the special entrypoint function `.main` is
|
|
|
|
devoid of logic, because in Node.js-style of programming, the module initializer takes care of entrypoint functionality.
|
|
|
|
|
|
|
|
## TODO: document more
|
|
|
|
|