Skip to content

Reduce repetition in the text format of canonical options#628

Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:less-verbose
Jun 9, 2022
Merged

Reduce repetition in the text format of canonical options#628
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:less-verbose

Conversation

@alexcrichton
Copy link
Member

Currently canonical options have a textual syntax that looks like:

(memory (core memory $name))

but personally this seems a bit wordy and repetitive to me. The "core"
part is already implied by the canonical lifting and lowering, and
otherwise the "memory" part is repeated. Alternatively I think it might
be a bit easier to read/write syntax of the form:

(memory $name)
(realloc $realloc)

without any loss in clarity. Additionally though this would still keep
the ability to reference and instance along the lines of:

(memory $libc "memory")

@alexcrichton alexcrichton requested a review from peterhuene June 8, 2022 16:05
@alexcrichton
Copy link
Member Author

I'm curious what you think of this @peterhuene and if you're ok I can try to send appropriate PRs to the upstream spec as well.

@peterhuene
Copy link
Member

I'm all for it. I agree it is needlessly verbose and there's precedent in other parts of the grammar for this syntax, e.g. instantiation of modules and components are done by index too.

Copy link
Member

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it; makes the canonical options easier to use.

Good to merge once Luke approves the spec change.

@alexcrichton
Copy link
Member Author

Adjusted for the syntax settled on WebAssembly/component-model#42

Currently canonical options have a textual syntax that looks like:

    (memory (core memory $name))

but personally this seems a bit wordy and repetitive to me. The "core"
part is already implied by the canonical lifting and lowering, and
otherwise the "memory" part is repeated. Alternatively I think it might
be a bit easier to read/write syntax of the form:

    (memory $name)
    (realloc $realloc)

without any loss in clarity. Additionally though this would still keep
the ability to reference and instance along the lines of:

    (memory $libc "memory")
@alexcrichton alexcrichton merged commit 7922736 into bytecodealliance:main Jun 9, 2022
@alexcrichton alexcrichton deleted the less-verbose branch June 9, 2022 15:10
code-terror pushed a commit to code-terror/wasm-tools that referenced this pull request Aug 24, 2022
…liance#628)

Currently canonical options have a textual syntax that looks like:

    (memory (core memory $name))

but personally this seems a bit wordy and repetitive to me. The "core"
part is already implied by the canonical lifting and lowering, and
otherwise the "memory" part is repeated. Alternatively I think it might
be a bit easier to read/write syntax of the form:

    (memory $name)
    (realloc $realloc)

without any loss in clarity. Additionally though this would still keep
the ability to reference and instance along the lines of:

    (memory $libc "memory")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants