@ 261106.1raw
current

Custom Annotation Syntax for the Wasm Text Format

Motivation

Problem

Solution

Details

Extend the Text Format as follows:

Extend the Appendix on the Custom Sections:

Examples

Expressing generic custom sections (cf. https://gist.github.com/binji/d1cfff7faaebb2aa4f8b1c995234e5a0)

(module
  (@custom "my-fancy-section" (after func) "contents-bytes")
)

Expressing names

(module (@name "Gümüsü")
  (func $lambda (@name "λ") (param $x (@name "α βγ δ") i32) (result i32) (local.get $x))
)

Web IDL bindings (cf. https://github.com/WebAssembly/webidl-bindings/blob/master/proposals/webidl-bindings/Explainer.mdgithub)

(module
  (func (export "f") (param i32 (@js unsigned)) ...)                        ;; argument converted as unsigned
  (func (export "method") (param $x anyref (@js this)) (param $y i32) ...)  ;; maps this to first arg
  (func (import "m" "constructor") (@js new) (param i32) (result anyref)    ;; is called as a constructor
)