Skip to content

Consider a shorthand for boolean fields #3114

Open
@nex3

Description

@nex3

I've found myself fairly frequently needing to do pattern matches where I check boolean fields of the object I'm matching against. However, it's substantially more verbose to do that using the pattern matching syntax than a standard boolean expression one might use in an if/else: object.isState becomes Type(isState: true). Some of this will be mitigated by #2563, but I suggest also allowing Type(isState) as a shorthand for Type(isState: true). I think special-casing booleans makes sense given that pattern matching is an intrinsically boolean context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureProposed language feature that solves one or more problemspatternsIssues related to pattern matching.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions