4 ms·
When to Say When: Reinventing the Switch Statement
- flinkerflitzer 2y agoI 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-stat.md#562--when-statements 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 https://github.com/jbunke/deltascript/releases/tag/v0.1.0