Skip to content

[FEATURE] pattern matching in variables #125

@LuisOtavio13

Description

@LuisOtavio13

Summary

Currently, no programming language accepts pattern matching in variables.

Problem

It's very verbose to use pattern matching on variables, so today I propose creating pattern matching for variables.

Proposed Solution

adopt the use of syntax

   let x {  y > 8 } =y+1;

x will have y+1 only if y is greater than 8.
x is Option

Impact Area

Mark the area most affected:

  • syntax / language design
  • frontend / parser
  • frontend / checker
  • middleend / IR
  • docs / workflow
  • tooling / CI
  • other

Example

func main() : (){
 let y = 10;
 let x { y > 7 } = 20;
()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions