effekt-lang / effekt-lang/effekt

Add non-nestable OR patterns without bindings

Open
#805 1 comment 2 reactions 0 assignees View on GitHub
feature requires-design
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

Support non-nestable OR patterns without bindings such as:
```scala
str match {
"YES" or "NO" => ...
_ => ...
}

car match {
case Car("Mercedes-Benz", _) or Car("smart", _) => ...
_ =>
}

people match {
case Cons("Joe", Nil()) or Cons("Jolene", Nil()) => ...
...
}
```

only on the top-level (no nesting -- much like `and`) and for patterns **without** bindings (those should be rejected).
This way, we get the 80% of use cases with 20% of the work of implementing actual nested OR patterns with bindings.

Then this change should be somewhat simple to add, just duplicating the branches.

Contributor guide

No contributing guide indexed for this repository

Research direction

No files or tests are named. Start by locating the compiler's pattern-matching implementation and the existing handling for top-level `and` patterns. Done means supporting the shown non-nestable OR patterns without bindings while rejecting OR patterns with bindings.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.