| OLD | NEW |
| 1 Sky module system | 1 Sky module system |
| 2 ================= | 2 ================= |
| 3 | 3 |
| 4 This document describes the Sky module system. | 4 This document describes the Sky module system. |
| 5 | 5 |
| 6 Overview | 6 Overview |
| 7 -------- | 7 -------- |
| 8 | 8 |
| 9 The Sky module system is based on the ```import``` element. In its | 9 The Sky module system is based on the ```import``` element. In its |
| 10 most basic form, you import a module as follows: | 10 most basic form, you import a module as follows: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 imported module: | 54 imported module: |
| 55 | 55 |
| 56 ```html | 56 ```html |
| 57 <import src="path/to/chocolate.sky" as="chocolate" /> | 57 <import src="path/to/chocolate.sky" as="chocolate" /> |
| 58 ``` | 58 ``` |
| 59 | 59 |
| 60 The parser executes the contents of script elements inside a module as | 60 The parser executes the contents of script elements inside a module as |
| 61 if they were executed as follow: | 61 if they were executed as follow: |
| 62 | 62 |
| 63 ```javascript | 63 ```javascript |
| 64 (new Function(module, name_1, ..., name_n, source_code)).call( | 64 (new Function(name_1, ..., name_n, module, source_code)).call( |
| 65 source_module, value_1, ..., value_n); | 65 value_1, ..., value_n, source_module); |
| 66 ``` | 66 ``` |
| 67 | 67 |
| 68 Where ```name_1``` through ```name_n``` are the names bound to the | 68 Where ```name_1``` through ```name_n``` are the names bound to the |
| 69 various named imports in the script element's document, | 69 various named imports in the script element's document, |
| 70 ```source_code``` is the text content of the script element, | 70 ```source_code``` is the text content of the script element, |
| 71 ```source_module`` is the ```Module``` object of the script element's | 71 ```source_module`` is the ```Module``` object of the script element's |
| 72 module, and ```value_1``` through ```value_n``` are the values | 72 module, and ```value_1``` through ```value_n``` are the values |
| 73 exported by the various named imports in the script element's | 73 exported by the various named imports in the script element's |
| 74 document. | 74 document. |
| 75 | 75 |
| 76 When an import fails to load, the ```as``` name for the import gets | 76 When an import fails to load, the ```as``` name for the import gets |
| 77 bound to ```undefined```. | 77 bound to ```undefined```. |
| OLD | NEW |