@@ -164,7 +164,7 @@ definition to be referred to by subsequent definitions (in the text and binary
164164format) via a nonnegative integral * index* . When defining, validating and
165165executing a component, there are 5 component-level index spaces:
166166* (component) functions
167- * (component) values
167+ * (component) values 🪙
168168* (component) types
169169* component instances
170170* components
@@ -2481,21 +2481,41 @@ of core linear memory.
24812481
24822482### Import and Export Definitions
24832483
2484- Both import and export definitions append a new element to the index space of
2485- the imported/exported ` sort ` which can be optionally bound to an identifier in
2486- the text format. In the case of imports, the identifier is bound just like Core
2487- WebAssembly, as part of the ` externdesc ` (e.g., ` (import "x" (func $x)) ` binds
2488- the identifier ` $x ` ). In the case of exports, the ` <id>? ` right after the
2489- ` export ` is bound while the ` <id> ` inside the ` <sortidx> ` is a reference to the
2490- preceding definition being exported (e.g., ` (export $x "x" (func $f)) ` binds a
2491- new identifier ` $x ` ).
2484+ Import and export definitions are similar to Core Webssembly import and export
2485+ definitions, but different in a few ways.
2486+
2487+ The first is that component-level imports have only a single name. (Two- and
2488+ even N-level imports can be achieved by importing ` instance ` types).
2489+
2490+ Second, component-level imports and exports can use all of the [ component-level
2491+ sorts] ( #index-spaces ) (` func ` , ` value ` 🪙, ` type ` , ` instance ` , ` component ` ) but
2492+ just 1 core sort: ` module ` . This restriction is enforced by validation which
2493+ assigns every component a [ ` componenttype ` ] ( #type-definitions ) (which similarly
2494+ only allows core types of the ` module ` type constructor). This restriction
2495+ ensures that all cross-component calls transit through a [ lift/lower
2496+ trampoline] ( #canonical-abi ) , which allows the Component Model to create a
2497+ "membrane" around all the core module instances contained by a component
2498+ instance in order to provide various structural guarantees to the Core
2499+ WebAssembly code running inside.
2500+
2501+ A third difference is that not only import definitions, but also export
2502+ definitions append a new element to the index space of the imported/exported
2503+ ` sort ` which can be optionally bound to an identifier in the text format. In the
2504+ case of imports, the identifier is bound just like Core WebAssembly, as part of
2505+ the ` externdesc ` (e.g., ` (import "x" (func $x)) ` binds the identifier ` $x ` ). In
2506+ the case of exports, the ` <id>? ` right after the ` export ` is bound while the
2507+ ` <id> ` inside the ` <sortidx> ` is a reference to the preceding definition being
2508+ exported (e.g., ` (export $x "x" (func $f)) ` binds a new identifier ` $x ` ).
2509+
2510+ Given this, the syntax of imports and exports are defined as follows:
24922511``` ebnf
24932512import ::= (import "<importname>" bind-id(<externdesc>))
24942513 | (import "<importname>" <versionsuffix> bind-id(<externdesc>)) 🔗
24952514export ::= (export <id>? "<exportname>" <sortidx> <externdesc>?)
24962515 | (export <id>? "<exportname>" <versionsuffix> <sortidx> <externdesc>?) 🔗
24972516versionsuffix ::= (versionsuffix "<semversuffix>") 🔗
24982517```
2518+
24992519All import names are required to be [ strongly-unique] . Separately, all export
25002520names are also required to be [ strongly-unique] . The rest of the grammar for
25012521imports and exports defines a structured syntax for the contents of import and
0 commit comments