Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

JS API: getters and setters (code migration) #154

Closed
bvibber opened this issue Oct 19, 2020 · 1 comment
Closed

JS API: getters and setters (code migration) #154

bvibber opened this issue Oct 19, 2020 · 1 comment

Comments

@bvibber
Copy link

bvibber commented Oct 19, 2020

It seems that the JS projection of GC structs as JS Typed Objects adds a generic getter/setter for each field that accesses that field, but there's no provision for custom getters and setters (for instance to get a synthesized value, or to be alerted when a property is changed so other internal state can change).

These could be provided in JavaScript by modifying the prototype with custom JavaScript getter/setter functions, at the cost of not exposting the property as an "own property".

The getters/setters would need to be JavaScript according to current spec due to #153.

Would this be a problem for code migration of existing JS APIs that use properties with getters/setters or would this sort of workaround be enough to reach the spec's code migration goals?

rossberg pushed a commit that referenced this issue Feb 24, 2021
The encoding of the table index in binary-leb128.wast is incorrect with the bulk-memory extensions, see WebAssembly/bulk-memory-operations#153. I saw and fixed the issue first in the reference types proposal (see WebAssembly/reference-types#95), but apparently it also exists here.
@tlively
Copy link
Member

tlively commented Apr 5, 2022

We've decided that custom getters, setters, field accessors, methods, etc. should be considered in a post-MVP proposal: https://github.com/webassembly/gc-js-customization. For the MVP, code migration will have to depend on manually wrapping idiomatic APIs around exported functions.

@tlively tlively closed this as completed Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants