[w3ctag/design-reviews] JS String Builtins for WebAssembly (Issue #940)

こんにちは TAG-さん!

I'm requesting a TAG review of JS String Builtins for WebAssembly.

JavaScript runtimes have a rich set of [builtin objects and primitives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects). Some languages targeting WebAssembly may have compatible primitives and would benefit from being able to use the equivalent JavaScript primitive for their implementation. The most pressing use-case here is for languages who would like to use the JavaScript String type to implement their strings. This proposal aims to provide a minimal and general mechanism for importing specific JavaScript primitives for efficient usage in WebAssembly code. 

This is done by first adding a set of wasm builtin functions for performing JavaScript String operations. These builtin functions mirror a subset of the [JavaScript String API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) and adapt it to be efficiently callable without JavaScript glue code. Then a mechanism for importing these wasm builtin functions is added to the WebAssembly JS-API. These two pieces in combination allow runtimes to reliably emit optimal code sequences for JavaScript String operations within WebAssembly modules. In the future, other JS builtin objects or JS primitives can be exposed through new wasm builtins.

  - Explainer (minimally containing user needs and example code): https://github.com/WebAssembly/js-string-builtins/blob/main/proposals/js-string-builtins/Overview.md
  - Specification URL: Formal spec not yet complete, but the above Overview specifies the feature thoroughly enough for Wasm Phase 2 requirements.
  - Tests: Not yet available; will be included before Phase 3
  - User research:  N/A
  - Security and Privacy self-review: N/A
  - Primary contacts (and their relationship to the specification):
      - Ryan Hunt (@eqrion), Mozilla/SpiderMonkey, proposal champion
      - Adam Klein (@ajklein), Google/Chromium/V8, proposal collaborator
  - Organization(s)/project(s) driving the specification: WebAssembly Community Group, Mozilla, Google
  - Key pieces of existing multi-stakeholder (e.g. developers, implementers, civil society) support, review or discussion of this specification:
    - WebAssembly CG meeting notes:
      - https://github.com/WebAssembly/meetings/blob/main/main/2023/CG-05-23.md
      - https://github.com/WebAssembly/meetings/blob/main/main/2023/CG-06-06.md
      - https://github.com/WebAssembly/meetings/blob/main/main/2023/CG-07-18.md
      - https://github.com/WebAssembly/meetings/blob/main/main/2023/CG-10.md#update-on-js-string-builtins-ryan-hunt
      - https://github.com/WebAssembly/meetings/blob/main/main/2024/CG-01-16.md
    - Supported by both Mozilla and Google as implementers of browser engines supporting WebAssembly
    - Desired by toolchain implementers targeting WasmGC: J2Wasm, Kotlin, Dart
  - External status/issue trackers for this specification (publicly visible, e.g. Chrome Status): 
    - [Chrome Status](https://chromestatus.com/feature/6695587390423040)

Further details:

  - [x] I have reviewed the TAG's [Web Platform Design Principles](https://www.w3.org/TR/design-principles/)
  - Relevant time constraints or deadlines: Planning to move to Phase 3 by June 2024
  - The group where the work on this specification is currently being done: WebAssembly Community Group
  - The group where standardization of this work is intended to be done (if current group is a community group or other incubation venue): WebAssembly Working Group
  - Major unresolved issues with or opposition to this specification: N/A
  - This work is being funded by: Mozilla, Google

You should also know that...

The current design is a result of extensive discussion in the Wasm CG over the past year (see above meeting notes), and follows a previous approach to dealing with strings directly in core Wasm, https://github.com/WebAssembly/stringref, which faced significant opposition in the CG.

We'd prefer the TAG provide feedback as (please delete all but the desired option):

  💬 leave review feedback as a **comment in this issue** and @-notify eqrion and ajklein

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/940
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/940@github.com>

Received on Thursday, 14 March 2024 17:29:37 UTC