Hacker News new | ask | show | jobs
When to Say When: Reinventing the Switch Statement (jbunke.github.io)
2 points by flinkerflitzer 523 days ago
1 comments

I designed and implemented my own scripting language, which features a control flow structure I wanted to get some feedback on!

The `when` statement in DeltaScript extends the traditional `switch` statement with types of cases for pattern matching and testing the control variable against a boolean function (predicate). It also does away with fallthrough.

Read about the semantics in detail: https://github.com/jbunke/deltascript/blob/master/docs/ls-5-... Download the entire language specification and/or play with the Java interpreter: https://github.com/jbunke/deltascript/releases/tag/v0.1.0