You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a large amount of hand-written Wasm code. It might be easier to maintain it if we could write it using a more concise syntax, with some syntactic sugar and type inference. This would involve writing a tool that can type-check the code and translate it to and from standard Wasm (possibly with source maps).
Some ideas:
Introduce local variables when they are first used rather than at the beginning of functions.
Use a single namespace for globals, locals, and functions, so that one can just write x instead of (local.get $x), (global.get $x) or (ref.func $x).
Recover missing type information through type inference: write e1 + e2 instead of (in32.add e1 e2), write e.m instead of (struct.get $t $m e).
We have a large amount of hand-written Wasm code. It might be easier to maintain it if we could write it using a more concise syntax, with some syntactic sugar and type inference. This would involve writing a tool that can type-check the code and translate it to and from standard Wasm (possibly with source maps).
Some ideas:
x
instead of(local.get $x)
,(global.get $x)
or(ref.func $x)
.e1 + e2
instead of(in32.add e1 e2)
, writee.m
instead of(struct.get $t $m e)
.For instance, consider this function:
We could write it like this using a Rust-like syntax:
Or with an OCaml-like syntax:
The text was updated successfully, but these errors were encountered: