First-class switch statement #630
rachitnigam
started this conversation in
Ideas
Replies: 2 comments
-
Seems pretty reasonable! But one thing I’m a little confused about: won’t we need some (moral equivalent of) the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sure, we can have a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Calyx currently supports multi-armed
if
statements but often times, frontend code would benefit from a first class switch statement instead. For example, this pattern seems to come up a few times:Where
cond0
andcond1
are really just doing the same comparison (think unrolled accesses generated from the Dahlia frontend). A better solution would be to have a switch-case style construct:if
can remain surface syntax that is compiled toswitch
statements.Beta Was this translation helpful? Give feedback.
All reactions