pulumi/docs/design/cocojs.md
joeduffy 86dc13ed5b More term rotations
This changes a few naming things:

* Rename "husk" to "environment" (`coco env` for short).

* Rename NutPack/NutIL to CocoPack/CocoIL.

* Rename the primary Nut.yaml/json project file to Coconut.yaml/json.

* Rename the compiled Nutpack.yaml/json file to Cocopack.yaml/json.

* Rename the package asset directory from nutpack/ to .coconut/.
2017-03-06 14:32:39 +00:00

20 lines
1,006 B
Markdown

# Coconut JavaScript (CocoJS)
CocoJS is a superset of a JavaScript (ECMAScript) subset. First, take a subset of JavaScript, and then superset it with
optional typing annotations (using TypeScript's syntax and semantics for them).
## Modules
CocoJS uses ES6-style modules.
An [ES6 module is a special kind of script](http://www.ecma-international.org/ecma-262/6.0/#sec-scripts-and-modules),
which is just a file containing a list of top-level statements. CocoIL modules have a bit more structure to them to
facilitate analysis and determinism. As a result, there is a mapping from CocoJS to CocoIL module structure.
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