It looks like the most primitive thing that works since ECMAScript 3rd Edition or even before is broken with WebAssembly opaque objects and I wonder who should I bug about it.
for (const k in ref);
TypeError: WebAssembly objects are opaque
This error has been “fun” to dig into but basically I’ve learned that a for…in over an opaque object could throw, as opposite of doing nothing, and I wonder why that would ever be the desired case … it’s literally something that has worked forever, it has no counter-utilities backed in able to crawl the prototypal inheritance, can we please amend this shenanigan that has been hard to dig into and absolutely unexpected?
A WebAssembly opaque object shows around as a random Object literal with a null prototype, and all operations work fine except the most primitive/simple one which is for…in and I believe a for..in should never, ever, throw on anything looking like an Object, acting like an object, showing toString as an Object, and so on … can we agree on this?
Thanks!
edit worth mentioning, also postMessage would drill into the fact that reference is a WebAssembly opaque object and fail at runtime to pass it around, as opposite of cloning it like `{_proto_: null}` instead ![]()
edit 2 also worth stating that Object.keys(wasm) or Reflect.ownKeys(wasm) don’t throw … why would for…in be that hostile instead of just ignoring opaque objects it cannot clearly in to?