Skip to content

Conversation

@dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Apr 20, 2023

This change unifies the so far available reference types by rebasing them on the non-nullable variants (matching the other types, e.g. string is non-nullable) while refactoring the canonical names like externref to become aliases. Hence all base types are non-nullable now, with the reference types prefixed with ref_ to avoid naming collisions (like string != ref_string) for the time being. The canonical names as per the spec remain as aliases of the nullable types. Using externref as an example:

AS type Wasm type Canonical Wasm type & AS alias
ref_extern (ref extern) -
ref_extern | null (ref null extern) externref

Idea is that we won't have to write nonnull<stringref> etc., but can reuse TS's | null notation in the transition to reference types, eventually leading full circle to writing string | null again, since once the respective naming collisions like string != ref_string can be resolved, we might simply drop the ref_ prefix.

Given that the previous type names remain as aliases and most of this is experimental anyway, this should otherwise be a non-functional change.

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file
@dcodeIO dcodeIO merged commit b248254 into main Apr 22, 2023
@dcodeIO dcodeIO mentioned this pull request Apr 22, 2023
2 tasks
@HerrCai0907 HerrCai0907 deleted the ref_types branch October 1, 2023 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants