Macaulay2 / Macaulay2/M2

`when .. is .. else ..` for top-level switch statements

Open
#2,350 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Interpreter
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.