Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use semicolons as delimiters in WIT text format #249

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

alexcrichton
Copy link
Collaborator

This commit commit is an implementation of #142 where semicolons are now required as delimiters between items in the WIT text format. All items in the WIT format are now delimited with either curly braces ({}) or semicolons except for the package statement where it subjectively felt a bit weird to require a semicolon. I've updated the various examples in WIT.md as an example of the new syntax.

My plan on implementing this would be along the lines of:

  • Implement the semicolon syntax in wit-parser
  • Add a parser mode which requires semicolons. This means that the same wit-parser crate can either or either not require semicolons.
  • Update all tests in the wasm-tools repository to require semicolons.
  • Publish wit-parser and wasm-tools, integrating the semicolon-supporting-mode into all existing tools.
  • Wait for Wasmtime to get published with this support. At this point everything in the ecosystem should have a point where semicolons are optionally supported.
  • Remove the parser mode which doesn't require semicolons, meaning semicolons are now required.
  • Push this update through the tooling, fixing any issues that arise.

The hope is to create a period of time where both syntax forms are accepted. This provides a transitionary means from one syntax to the other while proposals are updated. This transitionary period is finite in length, however.

Closes #142

This commit commit is an implementation of WebAssembly#142 where semicolons are now
required as delimiters between items in the WIT text format. All items
in the WIT format are now delimited with either curly braces (`{}`) or
semicolons except for the `package` statement where it subjectively felt
a bit weird to require a semicolon. I've updated the various examples in
`WIT.md` as an example of the new syntax.

My plan on implementing this would be along the lines of:

* Implement the semicolon syntax in `wit-parser`
* Add a parser mode which requires semicolons. This means that the same
  `wit-parser` crate can either or either not require semicolons.
* Update all tests in the `wasm-tools` repository to require semicolons.
* Publish `wit-parser` and `wasm-tools`, integrating the
  semicolon-supporting-mode into all existing tools.
* Wait for Wasmtime to get published with this support. At this point
  everything in the ecosystem should have a point where semicolons are
  optionally supported.
* Remove the parser mode which doesn't require semicolons, meaning
  semicolons are now required.
* Push this update through the tooling, fixing any issues that arise.

The hope is to create a period of time where both syntax forms are
accepted. This provides a transitionary means from one syntax to the
other while proposals are updated. This transitionary period is finite
in length, however.

Closes WebAssembly#142
Copy link
Member

@lukewagner lukewagner left a comment

Choose a reason for hiding this comment

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

Thanks for writing this up! Agreed this is probably the right answer when we think long-term. lgtm, but I'd be interested to wait for a bit to collect other feedback.

@alexcrichton
Copy link
Collaborator Author

I've got a PR for an implementation of this when it's ready at bytecodealliance/wasm-tools#1212 which can also serve as a means to evaluate the aesthetics of the change via reading all the changes to tests. (aesthetics improved IMO)

@lukewagner
Copy link
Member

Looks like no disagreement, so merging.

@lukewagner lukewagner merged commit 01ebd9e into WebAssembly:main Sep 25, 2023
1 check passed
@alexcrichton alexcrichton deleted the semicolons branch September 26, 2023 13:49
alexcrichton added a commit to alexcrichton/component-model that referenced this pull request Sep 27, 2023
This is a follow-up to WebAssembly#249 and discussion in today's component model
meeting to require semicolons after the `package` statement to ensure
it's consistent with all other "single line things" in the WIT format.
lukewagner pushed a commit that referenced this pull request Sep 28, 2023
This is a follow-up to #249 and discussion in today's component model
meeting to require semicolons after the `package` statement to ensure
it's consistent with all other "single line things" in the WIT format.
alexcrichton added a commit to alexcrichton/wasi-io that referenced this pull request Oct 6, 2023
sunfishcode pushed a commit to WebAssembly/wasi-io that referenced this pull request Oct 6, 2023
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.

wit feature request: add explicit item delimiters
2 participants