NOTE: This is only for text format, no changes are considered to binary format.
- The "compact encoding 2" looks inconsistent with existing import syntax. Especially, identifier is disallowed in extern type.
- This form makes parser implementation becoming more complex, since parser can't easily guess or predict by peeking
(item. Also, there will be more work for checking whether to allow identifier or not when parsing extern type.
- This form makes language server/IDE hard to analyze. In wasm-language-tools, it's easy to analyze the following code:
(import "env" "a" (global i32))
(import "env" (item "b" (global i32))
since each "import" AST node has only one extern type as its child AST node.
But for:
(import "env" (item "a") (item "b") (global i32))
Extern type is no longer a child AST node of the (item) clause, making analysis becoming hard. Also, when user using "Go to definition" in editor for "global a" or "global b", it always points to (global i32) (because that extern type is shared), which is confusing.
- For binary format, "compact encoding 2" can reduce wasm binary size so this makes sense. But for text format, that's not the case. Text format isn't usually for being transferred. Instead, they're the source code of binary format (or decompilation result), so file size isn't a problem.
NOTE: This is only for text format, no changes are considered to binary format.
(item. Also, there will be more work for checking whether to allow identifier or not when parsing extern type.But for:
(item)clause, making analysis becoming hard. Also, when user using "Go to definition" in editor for "global a" or "global b", it always points to(global i32)(because that extern type is shared), which is confusing.