Skip to content

Multi-expression matching support #140

Description

@Lyrth

Would it be possible (and useful) to have match accept multiple expressions? Each match expression will match the corresponding case expression and evaluated as an and for each expression in a case.

local a, b = 2, 5
match a, b+1 {
  1,   a   => { print('no') }
  2,   4   => { print('neither') }
  b-1, 6   => { print('nay') }
  2,   a*3 => { print('THIS CASE will be selected') } 
}

If implemented, will probably be neater to have "passthrough" case expressions too, that technically works as a wildcard that always matches for that case expression, albeit it might be difficult to come up with a symbol (or existing keyword) for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexperimentalThe changes may break something or be a bad idea

    Type

    No type

    Fields

    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