You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
The DefaultValue algorithm needs updating to handle more general reference types. Moreover, it is partial now, so all use sites need to adapt to the possibility of it failing.
Also, this algorithm is unrelated to JS and in fact duplicates the respective definition in the core spec. It might be preferable to expose that in the core spec's embedding interface and call into that.
Also, this algorithm is unrelated to JS and in fact duplicates the respective definition in the core spec. It might be preferable to expose that in the core spec's embedding interface and call into that.
The JS-API default value function is slightly different than wasm's default value function. JSAPI-DefaultValue(externref) = undefined, while Wasm-DefaultValue(externref) = null. This is thanks to JS filling in missing parameters with undefined.
Fair enough, but it would still be preferable to handle only this special case here and then defer to the core spec for all regular cases.
(Although personally I still think this special case is odd and instead it should only use undefined if explicitly given, not as default. There is precedence in JS for treating an absent parameter differently from explicit undefined, e.g., [].reduce(() => 0) throws TypeError, whereas [].reduce(() => 0, undefined) returns undefined.)
Activity
eqrion commentedon Dec 20, 2023
The JS-API default value function is slightly different than wasm's default value function.
JSAPI-DefaultValue(externref) = undefined, whileWasm-DefaultValue(externref) = null. This is thanks to JS filling in missing parameters withundefined.rossberg commentedon Dec 21, 2023
Fair enough, but it would still be preferable to handle only this special case here and then defer to the core spec for all regular cases.
(Although personally I still think this special case is odd and instead it should only use undefined if explicitly given, not as default. There is precedence in JS for treating an absent parameter differently from explicit undefined, e.g.,
[].reduce(() => 0)throws TypeError, whereas[].reduce(() => 0, undefined)returnsundefined.)[js-api][test] Refine DefaultValue for new reference types