Skip to content

Possible confusion between the unit type and the 0-tuple #21

@alexcrichton

Description

@alexcrichton

Currently interface types has both a unit as well as a tuple type, and the tuple type can have any number of fields. This raises a possible ambiguity for languages like Rust where the 0-tuple, (), is equivalent to Rust's "unit" type, also (). This might be a good opportunity to perhaps be a bit conservative and go ahead and make the 0-tuple a validation error perhaps?

Additionally one other possible thing we may want to do is in addition to making 0-tuples a validation error we could also make 1-tuples a validation error as well. At least in Rust 1-tuples are convenient for macro-generated code and things like that but otherwise are pretty rarely used. 1-tuples are pretty hard to work with as they're syntactically (T,) (not to be confused with the (T) type which is just T). Given that the component model is probably pretty far from macro-generated things it might be good to go ahead and say that 0- and 1-tuples are validation errors? (with the possibility of opening them up in the future of course)

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