WebAssembly / WebAssembly/WASI

[http] Request and Response's `new` method is reserved in many languages, inconsistent with sockets.

Open Beginner friendly
#961 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Languages like Java and C++ disallow static methods named new, so methods like new on Request will have to be modified to something like new_. That's fairly ugly, so a better option would be something like create, which isn't a reserved word in any mainstream language that I know of.

https://github.com/WebAssembly/WASI/blob/39c11a76958d015ace3f1bf68500057a28c7837f/proposals/http/wit/types.wit#L308

new is also inconsistent with tco-socket and udp-socket which already use create: https://github.com/WebAssembly/WASI/blob/39c11a76958d015ace3f1bf68500057a28c7837f/proposals/sockets/wit/types.wit#L195

So it'd be both a translation and consistency win to rename new to create.

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 by reading proposals/http/wit/types.wit at the linked Request and Response definitions, then compare the constructor naming with proposals/sockets/wit/types.wit at the linked tco-socket and udp-socket definitions. Done means the HTTP constructors use create rather than new and are consistent with the socket interfaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
api
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.