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.
#130 and #142 identify some disadvantages to having externref be a subtype of anyref. I am wondering what the advantages are. Note that, after upcasting externrefs to anyrefs, there is no reliable way to downcast the resulting anyrefs back to externrefs, making the subtyping a one-way street. Consequently, it seems to me that a module mixing externrefs with its own values (uniformly represented as anyrefs) would want to box the externrefs in some manner, both to provide a way to later unbox them and to prevent bugs that could be caused by unintended/unanticipated overlaps between externref values and the module's own values. This boxing pattern would not need externref to be a subtyping of anyref. And if the boxing pattern is indeed common and we leave externref as a subtype of anyref, then that would mean that foreign references would first get boxed to become externrefs that are compatible with anyrefs, which would then get boxed again by the application, and then the reverse for unboxing.