5 ms·
Personally I feel this is backwards - I don't want access to js literals and objects from WASM, I just want a way to wrap an arbitrary array buffer that contain
by samwillis 1y ago
Personally I feel this is backwards - I don't want access to js literals and objects from WASM, I just want a way to wrap an arbitrary array buffer that contains a utf16 string as a js string.
It keeps WASM simple and provides a thin layer as an optimisation.
- deleted 1y ago[deleted]
- vanderZwan 1y ago> It keeps WASM simple At the cost of complicating JS string implementations, probably to the point of undoing the benefits. Currently JS strings are immutable objects, allowing for all kinds of optimization tricks (interning, ropes, etc.). Having one string represented by a mutable arraybuffer messes with that. There's probably also security concerns with allowing mutable access to string internals inside the JS engine side. So the simple-appearing solution you suggested would be rejected all major browser vendors who back the various WASM and JS engines. Access to constant JS strings without any form of mutability is the only realistic option for accessing JS strings. And creating constant strings is the only one for sending them back.
- deleted 1y ago[deleted]