-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add guard expressions to pattern matching #98
base: trunk
Are you sure you want to change the base?
Conversation
9f73dfb
to
2fc3e66
Compare
TODO: add some EvalTests |
Would the question mark operator work here?
|
Yes, although I think it is already being used for what I originally understood as an assert. We can repurpose as guard (which won't raise/crash). Or we can rename to I'm a liiiiittle wary of having a bunch of symbols |
Yeah, Regarding symbols, one of my design goals of scrapscript is to actually have no alphabetic keywords in the whole language! I don't know why this was a goal of mine, but I think it's a constraint that's encouraged "small" thinking. |
I think if we drop its meaning as assert and instead use it to mean guard (and fall-through on guard failure, instead of crash), sure, why not |
Then it's possible to write |
Love it! Great idea |
Adds guards to pattern matching:
Where guards run in a merged version of the match case env and the env created by the pattern matching.