Skip to content

Type ascription (ascription of patterns) #354

Closed
@nrc

Description

@nrc

Post-1.0, we would like to allow arbitrary type ascription - that is annotating any expression with a type. E.g., let _ = foo(x, y: Bar<int>, z); (type ascription on the sub-expression y).

Detail to be nailed down - precedence (probably the same as as).

Optional extra - type ascription on patterns, e.g. let (x: Bar<int>, y) = foo(...); - useful when you care about the type of some part of the pattern but not others, especially when the bits you don't care about are _.

Optional, optional extra - using the ascribed types in pattern matching for downcasting (an extension of some #349 proposals).

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.postponedRFCs that have been postponed and may be revisited at a later time.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions