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
{{ message }}
Repository navigation
Reword 6.6.5.1. Function Abbreviations to be more specific about impact #1418
The WebAssembly 1.0 (MVP) and 1.1 draft both allow repetition and co-mingling of inlined/abbreviated function import and exports.
The wording "The latter abbreviation can be applied repeatedly, with “…” containing another import or export." is more wide than necessary. The only possible grammar seems (export)* (import)? because the "import", if present, must be present at the end.
For example, the valid combinations besides no inlined import/export
only import -> this means the func cannot have a body or locals, it is effectively a different way of writing import func
N exports -> this is a module-defined func where N exports point to the current position in the index namespace
N exports then import -> this is an imported function re-exported N times
To figure these points out from the spec requires too much thinking, so I think the section can be worded, ya?
Actually, per the grammar, I think it should be possible to have exports after a single import, just not more than one import. However, in practice, both wabt and wasm-tools require an abbreviated import to be last.
Ex. (export)* (import)?: This parses in both wat2wasm and also wasm-tools (both latest)
Presuming no-one has complained, I'm personally ok restricting this to (export)* (import)?, but if it is an oversight, I'd rather implement the full grammar allowed (export)* (import)? (export)*. To know the difference, I'd appreciate some feedback from folks familiar if you don't mind.
actually I can see how this can result in the terminal import as the first abbreviation has no trailing ...
So, that means (export)* (import)? (export)* is invalid and (export)* (import)? is valid
Meanwhile, took a while to figure out which may be due to my denseness. hope something in this issue can be of use to make things more obvious or at least obvious faster than it took me!
FWIW if it wrote the same info more straightforwardly, like (export)* (import)? I think I would have gotten this point quicker as the relationship of type use (param)* (result)? wasn't so hard on me and is basically the same.
"The latter abbreviation can be applied repeatedly, with “…” containing another import or export."
^^ this seems to hint that you can do (export) (import) (export) (import) resulting in multiple imports that won't work as there can be at most one and really only exports can repeat.
IOTW, I think even if the grammar can be interpreted correctly as is, it wouldn't hurt to help it become interpreted correctly. Meanwhile, closing this issue to whatever end the WG feels as I've made copious notes on my side regardless..
Activity
codefromthecrypt commentedon Feb 10, 2022
Actually, per the grammar, I think it should be possible to have exports after a single import, just not more than one import. However, in practice, both wabt and wasm-tools require an abbreviated import to be last.
Ex.
(export)* (import)?: This parses in both wat2wasm and also wasm-tools (both latest)Ex.
(export)* (import)? (export)*: This fails on both of the above, but per the description in the spec, I actually think it shouldn't.Presuming no-one has complained, I'm personally ok restricting this to
(export)* (import)?, but if it is an oversight, I'd rather implement the full grammar allowed(export)* (import)? (export)*. To know the difference, I'd appreciate some feedback from folks familiar if you don't mind.codefromthecrypt commentedon Feb 10, 2022
cc @rossberg - spec side
cc @alexcrichton - wasm-tools
cc @sbc100 - wabt
codefromthecrypt commentedon Feb 10, 2022
actually I can see how this can result in the terminal import as the first abbreviation has no trailing ...
So, that means
(export)* (import)? (export)*is invalid and(export)* (import)?is validMeanwhile, took a while to figure out which may be due to my denseness. hope something in this issue can be of use to make things more obvious or at least obvious faster than it took me!
FWIW if it wrote the same info more straightforwardly, like
(export)* (import)?I think I would have gotten this point quicker as the relationship of type use(param)* (result)?wasn't so hard on me and is basically the same.Clarifies the note on text format export abbreviation expansion to re…
codefromthecrypt commentedon Feb 10, 2022
#1420 is best I can do to clarify this
"The latter abbreviation can be applied repeatedly, with “…” containing another import or export."
^^ this seems to hint that you can do (export) (import) (export) (import) resulting in multiple imports that won't work as there can be at most one and really only exports can repeat.
IOTW, I think even if the grammar can be interpreted correctly as is, it wouldn't hurt to help it become interpreted correctly. Meanwhile, closing this issue to whatever end the WG feels as I've made copious notes on my side regardless..
Clarifies the note on text format export abbreviation expansion to re…