WebAssembly / gc

Branch of the spec repo scoped to discussion of GC integration in WebAssembly
https://webassembly.github.io/gc/
Other
987 stars 71 forks source link

MVP-JS wording issue #495

Closed ericvergnaud closed 9 months ago

ericvergnaud commented 9 months ago

The MVP-JS.md contains the following paragraph:

The wrapper objects supports the following JS operations:

  • GetPrototypeOf: returns null.
  • SetPrototypeOf: returns false (and does not set a prototype).
  • IsExtensible: returns false.
  • PreventExtensions: returns false.
  • GetOwnProperty: returns undefined.
  • DefineOwnProperty: returns false.
  • HasProperty: returns false.
  • Get: returns undefined.
  • Set: throws a TypeError.
  • Delete: throws a TypeError.
  • OwnPropertyKeys: returns an empty list.

These operations may be extended in the future to support more useful ways of interacting with Wasm GC objects from JS.

In the above, it's unclear whether these operations can be invoked from the wrapper itself or from the JS Object API

If the former, then there is a need to describe how one would even know that the wrapper is a wrapper once the object starts being circulated in application code (and if they do know, then how useful are these methods ?).

If the latter, then there might be a few inaccuracies in the list. For example, given a JS value obj, there is no obj.GetPrototypeOf() operation on a JS object, rather one needs to call Object.getPrototypeOf(obj).

I'll happily submit a PR to fix the latter if it's the intent.

ericvergnaud commented 9 months ago

Closing, after digging a bit, it seems these are expressed in terms of the WebAssembly JS API, not in terms of the JS language.

rossberg commented 9 months ago

To clarify, these define the behavioural methods of the JavaScript meta object protocol as specified by ECMAscript.