Skip to content

Use formal wit syntax within doc? #579

@peter-jerry-ye

Description

@peter-jerry-ye

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions