WebAssembly / component-model

Repository for design and specification of the Component Model
Other
897 stars 75 forks source link

Filling out the WAT inline alias syntax #351

Open lukewagner opened 2 months ago

lukewagner commented 2 months ago

(Filing this for consideration later in a polish phase before 1.0; I don't expect this is a high priority until then since it's additive and I haven't heard anyone asking for it.)

276 pointed out that it might be nice for the inline alias syntax to be co-expressive with out-of-line aliases and, as part of what this syntax would look like, that we don't necessarily need explicit export or outer tokens to discriminate the two cases (b/c they are lexically distinct).

Thus, a complete set of inline alias syntaxes could be:

(sort 1 2)    ~> (alias outer 1 2 (sort))
(sort $C 2)   ~> (alias outer $C 2 (sort))
(sort 1 $f)   ~> (alias outer 1 $f (sort))
(sort $f)     ~> (alias outer $f (sort))
(sort $C "e") ~> (alias export $C "e" (sort))
(sort 1 "e")  ~> (alias export 1 "e" (sort))