Skip to content

WIT: consider dropping unions #236

Closed

Description

@lann

Unions are uniquely challenging to implement in bindings because their cases do not have kebab-case names. See for example the wit-bindgen Rust generator's awkward solution to this: https://github.com/bytecodealliance/wasmtime/blob/367bdc8c66df62d6854966a90564b42692a3f023/crates/wit-bindgen/src/rust.rs#L317

Rather than expecting each bindings language to come up with a generic naming scheme to handle unions, I think we should put the onus on WIT authors to select reasonable case names on an equivalent variant.

A quick Github search (and review of WASI) suggests that unions are not currently in use outside of tests and samples.

Activity

  1. alexcrichton commented on Aug 21, 2023

    @alexcrichton
    Collaborator

    Personally I'd agree with this and would be in favor 👍

  2. lukewagner commented on Aug 21, 2023

    @lukewagner
    Member

    I'd be fine dropping them too. Initially they were added because the proposal spawned out of Web IDL, which has union. But yeah, I can see how it ends up being a special case for many languages, especially the statically-typed ones.

  3. guybedford commented on Aug 21, 2023

    @guybedford
    Collaborator

    Even in JavaScript, they're still tagged awkwardly and don't actually correspond to the IDL / TypeScript equivalents, so this seems fine to me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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