WebAssembly / WebAssembly/component-model

WIT - inline definitions

Open
#135 6 comments 1 reaction 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

Not pressing by any means, more nice-to-have, but thought I'd post while I'm thinking about it.

Just like one can define an inline tuple or result, it could be useful to define inline definitions.

That is, instead of:

enum error {
  error-a,
  error-b
}
record param-type {
  name: string,
  value: option<string>
}
func p: (param: param-type) -> result<_, error>

Writing:

func p: (param: record {
  name: string,
  value: option<string>
}) -> result<_, enum {
  error-a,
  error-b
}>

Where the above could be internalized as sugar for some anonymous type naming scheme (ideally derived from the function and param name itself, as opposed to its structure).

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

The issue proposes inline WIT record and enum definitions as syntax sugar for anonymous types, but names no files, tests, or implementation entry points. Start by reviewing the existing WIT type-definition and function-signature specification; done requires an agreed design for naming, scoping, and semantics before implementation can begin.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.