`when .. is .. else ..` for top-level switch statements
Nobody has claimed this yet.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
The d language already has a switch statement. Why doesn't top-level M2 support something similar?
```m2
when class x (
is ZZ do print "integer"
is QQ do print "rational"
else print "neither"
)
```
Ideally this should also check inheritance, so for instance a `MonomialIdeal` would pass as an `Ideal`, or `QuotientRing` pass as a `Ring`.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or implementation entry points. Start by locating the parser and evaluator for top-level `when` statements, then determine how class matching and inheritance are represented. Done means supporting the shown branches, including the `else` case and inherited class matches, with tests covering them.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100