evhub / evhub/coconut

Extend assignment function notation / make more things expressions

Open
#190 10 comments 2 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
4.4k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

I think it would be useful if "match" and "case" statements were actually expressions. For example, I'd like to be able to do things like:

```
def whats_this(foo) =
case foo:
match 0:
#
"Zero"
match 1:
#
"One"
else:
"Dunno"

assert "Zero" == whats_this(0)
assert "One" == whats_this(1)
assert "Dunno" == whats_this(2)
```

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; start by tracing Coconut's compiler and parser entry points for match and case. Use the example as the acceptance case: assignment-function notation should accept these constructs as expressions and return the selected branch value, including the else branch.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.