WebAssembly / WebAssembly/threads

Potential web compatibility issue with exports of globals

Open
#73 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
767
Forks
54
PR merge metrics
No merged PRs in 30d

Description

From Globals.md, in the WebAssembly.Instance constructor

  1. if e is a global instance g with global_type gt:
    1. Return a new WebAssembly.Global with [[Global]] set to g and [[GlobalType]] set to gt.

Does this apply even for existing, immutable globals? It seems like if a website is using the global values with WebAssembly now, this would change how they would have to use it, resulting in a potential compatibility issue. Or am I understanding this wrong?

One workaround would be to expose constants as their value, and expose mutable globals as a WebAssembly.Global. This could still allow constant WebAssembly.Global objects to be constructed and used as imports.

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 the globals behavior described in Globals.md and the quoted WebAssembly.Instance constructor steps. Compare the treatment of existing immutable globals with current WebAssembly usage and assess the proposed distinction between constant values and mutable WebAssembly.Global objects. Done means reaching and documenting a clear compatibility decision; no test file is named.

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
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.