WebAssembly / WebAssembly/component-model

🪙 Value text encoding ambiguities / quirks

Open
#718 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

In looking at WAVE mapping to value defs (ref https://github.com/WebAssembly/component-model/pull/639#issuecomment-4292311870) I found some quirks in the val rules:

  • char
    • Allows unescaped single quote (value char '''), which is unambiguous in context but seems awkward to parse and confusing to read (especially if you're used to Python!).
    • Rejects unescaped double-quote ('"'), which is slightly annoying to me, personally. 🙂
  • floats
    • f32 is encoded as core:f64 which leaves rounding and overflow ambiguous, e.g. core:f64 accepts 1e99 which will overflow an f32.
    • f64canon rejects nan:0x but not -nan
  • Handles in variants:
    • Currently this would seem to be valid: (value (option (future)) none), which is at least surprising if not actually wrong.
  • Ints:
    • Depending on how I squint it looks like (value u64 -1) might be valid via core:i64 (wrapping to u64::MAX).

Separately: the bottom of the value definitions section describes value imports/exports but the import/export defs are missing matching rules. Nope, I was looking in the wrong place.

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 with the value definitions section in design/mvp/Explainer.md and compare its val rules with the WAVE mapping and the referenced value definitions. Trace the char, float, handle, and integer cases, then determine the intended grammar and validation behavior for each ambiguity. Done means the specification has an agreed, unambiguous treatment of the reported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.