@@ -22,7 +22,7 @@ JavaScript runtimes. For a more user-focussed explanation, take a look at the
22
22
* [ Canonical definitions] ( #canonical-definitions )
23
23
* [ Canonical ABI] ( #canonical-built-ins )
24
24
* [ Canonical built-ins] ( #canonical-built-ins )
25
- * [ Start definitions ] ( #-start-definitions )
25
+ * [ Start Definitions ] ( #-start-definitions )
26
26
* [ Import and export definitions] ( #import-and-export-definitions )
27
27
* [ Component invariants] ( #component-invariants )
28
28
* [ JavaScript embedding] ( #JavaScript-embedding )
@@ -1305,15 +1305,28 @@ See the [CanonicalABI.md](CanonicalABI.md#canonical-definitions) for detailed
1305
1305
definitions of each of these built-ins and their interactions.
1306
1306
1307
1307
1308
- ### 🪙 Start Definitions
1308
+ ### Start Definitions
1309
1309
1310
1310
Like modules, components can have start functions that are called during
1311
- instantiation. Unlike modules, components can call start functions at multiple
1312
- points during instantiation with each such call having parameters and results.
1311
+ instantiation. Unlike modules, component dependencies are always acyclic,
1312
+ so their dependencies are always initialized first, so they can call
1313
+ imports without any special considerations.
1314
+
1313
1315
Thus, ` start ` definitions in components look like function calls:
1314
1316
``` ebnf
1315
1317
start ::= (start <funcidx> (value <valueidx>)* (result (value <id>?))*)
1316
1318
```
1319
+
1320
+ If multiple start definitins are present in a component, they are called in
1321
+ the order they appear in the encoding.
1322
+
1323
+ Currently, the ` (value <valueidx>)* ` and ` (result (value <id>?)) ` lists are
1324
+ required to be empty, and ` <funcidx> ` must refer to a function with no
1325
+ arguments or return values. In the 🪙 future, these will allow the calls
1326
+ to be passed arguments and return results.
1327
+
1328
+ #### 🪙 Start Definition arguments and results
1329
+
1317
1330
The ` (value <valueidx>)* ` list specifies the arguments passed to ` funcidx ` by
1318
1331
indexing into the * value index space* . Value definitions (in the value index
1319
1332
space) are like immutable ` global ` definitions in Core WebAssembly except that
0 commit comments