WebAssembly / WebAssembly/WASI

Confusing syntax in API documentation

Open
#326 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

Looking at https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md

For example, the function environ_sizes_get is shown as environ_sizes_get() -> (errno, size, size). This looks like it's returning three values, but if I compile a simple program to WASI this is the type of the function:

  (type (;3;) (func (param i32 i32) (result i32)))
  ...
  (import "wasi_snapshot_preview1" "environ_sizes_get" (func $__wasi_environ_sizes_get (type 3)))

So it's actually taking two args and returning one value.

I have no idea what the args are, I'm guessing they're memory locations to return values, first one is for errno, second one is for the first size, but I'm not sure. It'd be good to describe the syntax in the API docs.

Contributor guide

Open the contributing guide

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 phases/snapshot/docs.md and inspect the environ_sizes_get entry alongside the issue's generated WASI type. Determine how the documented notation represents parameters, return values, and memory locations, then update the API documentation so the function signature and argument roles are unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.