Skip to content

Ambiguity in proposed pattern syntax #656

Closed
@marijnh

Description

@marijnh

Colons will allow specifying the types of pattern elements (let x: int = 6), but are also used as separators between field names and sub-patterns in record patterns ({x: ?binding}). Since we allow the sub-pattern to be omitted ({x} is interpreted as {x: ?x}) this introduces an ambiguity—the parser can't tell whether a colon in a record pattern indicates a sub-pattern or a type.

Possible solutions include using another character for type assertions or simply specifying that the patterns has to be written out in full if you want to type it (resulting in the rather ugly {x:?x:int}).

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