Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

anyref == externref introduces a typesystem mode #296

Closed
@titzer

Description

@titzer

I didn't notice this until I updated Wizard after #271, which makes externref an alias for anyref. Unfortunately a consequence of this is that, from a Wasm binary's perspective, funcref (-0x10), which was previously not a subtype of externref (-0x11), is now a subtype of (-0x11), though we've got a different text-level name for it. We've changed the meaning of that binary type.

That introduces a mode in the engine; if the engine supports the GC proposal, then (-0x10) <: (-0x11), and if not, then (-0x10) </: (-0x11).

The only clean way I saw to resolve this, if an engine wants to support the current spec, but also a proposal in the works, is to model all the types, i.e. both externref and anyref, as before, but the mode flag flips the meaning of (-0x11).

The same thing will happen, but worse, with function-references. We currently don't have subtyping between function types, but we'll want to add it in the future. That'll be another mode flag that changes the type system underneath.

We need to be careful how we introduce type relations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions