LytixDev / slash

The Slash Scripting Language
GNU General Public License v3.0
7 stars 0 forks source link

feat: match statement #21

Open LytixDev opened 1 year ago

LytixDev commented 1 year ago

Slash will not have a switch statement, but rather a match statement. The key difference, as I see it, is that the switch statement has at most one possible match for each possibility (which can lead to optimizations like a simple index into a table). We don't care about being super fast, so the conjectured performance drawback is not an issue. I want the match statement to be more flexible and by extension more powerful than the classical switch statement found in C.

I am unsure exactly how the syntax will look and how precisely it will match. I think a powerful match statement requires an underlying and powerful pattern matching system built into the language.