Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify reference types #2689

Merged
merged 5 commits into from Apr 22, 2023
Merged

Unify reference types #2689

merged 5 commits into from Apr 22, 2023

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
12 checks passed
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant