RESOLVED DUPLICATE of bug 247403 240982
[Wasm-GC] Change externref to anyref
https://bugs.webkit.org/show_bug.cgi?id=240982
Summary [Wasm-GC] Change externref to anyref
Asumu Takikawa
Reported 2022-05-26 14:58:56 PDT
The Wasm GC proposal unifies the externref type and anyref type (https://github.com/WebAssembly/gc/pull/271). Right now, externref allows host values and has no subtyping relationship with other types. With the change to anyref, an anyref will allow host types, but it will also be allowed to be downcast to more specific reference types once casting operations are added. An anyref type parameter, e.g. for a function, will accept other reference types in the hierarchy as well. (It is possible funcrefs will be excluded from the anyref hierarchy https://github.com/WebAssembly/gc/issues/293) When Wasm GC is disabled, externref should still function as it does right now.
Attachments
Radar WebKit Bug Importer
Comment 1 2022-06-02 14:59:13 PDT
Asumu Takikawa
Comment 2 2022-07-01 13:17:21 PDT
There is still a lot of discussion about what the role of `anyref`, `externref`, etc should be in the GC proposal: https://github.com/WebAssembly/gc/issues/307 I think until this is clear, it's best to avoid implementing `anyref` (it's unclear if a "top type" is even going to be in the final type hierarchy). It might make sense to instead implement types like `dataref` (structs & arrays) and `eqref` (dataref + i31ref) initially.
Asumu Takikawa
Comment 3 2022-07-21 14:20:08 PDT
Recent discussions (in issue https://github.com/WebAssembly/gc/issues/307) and subsequent changes to the spec (https://github.com/WebAssembly/gc/pull/310) have actually undone the unification of externref and anyref types in the GC proposal. So this issue can be closed unless the design changes again. Instead, for the GC proposal we will need to add an anyref as a new supertype of all GC datatypes.
David Degazio
Comment 4 2024-07-30 16:29:41 PDT
Revisiting from the future, anyref and externref remain separate types, with anyref as the overall top type and externref being one of its subtypes. Support for anyref was added in https://bugs.webkit.org/show_bug.cgi?id=247403 and is consistent with the current state of the spec as far as I am aware. Closing as dupe. *** This bug has been marked as a duplicate of bug 247403 ***
David Degazio
Comment 5 2024-07-30 16:32:45 PDT
Er, quick correction, anyref is not the supertype of externref, there is a conversion between the two - implemented in https://bugs.webkit.org/show_bug.cgi?id=251039. We can still close this bug.
Note You need to log in before you can comment on or make changes to this bug.