WebAssembly / WebAssembly/component-model

Use formal wit syntax within doc?

Open
#579 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
1.4k
Forks
130
Avg merge
2d 1h
Merged PRs (30d)
15

Description

I noticed that for explaning event in explainer, it is written as:

variant event {
    none,
    subtask(subtask-index, subtask-state),
    stream-read(stream-index, stream-result),
    stream-write(stream-index, stream-result),
    future-read(future-index, future-read-result),
    future-write(future-index, future-write-result),
    task-cancelled,
}

However, per cm ast, it says:

defvaltype    ::= bool
                | s8 | u8 | s16 | u16 | s32 | u32 | s64 | u64
                | f32 | f64
                | char | string
                | error-context 📝
                | (record (field "<label>" <valtype>)+)
                | (variant (case "<label>" <valtype>?)+)

Although I assume the event is never lowered / lifted in the same way as variants (the code is returned directly and the data are picked up from the memory, or passed as arguments in callback style), is it possible that we use some consistent way to describe it, or relax the restriction on variant?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the event example in the explainer with the defvaltype grammar attributed to the component-model AST. Determine whether the documentation should use formal syntax or explain an exception for events; done means the syntax and its rationale are consistent and the relevant documentation is updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.