-
Notifications
You must be signed in to change notification settings - Fork 90
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
Why is if
a guard instead of a combinator?
#255
Comments
Because |
Ok, let's drop the term "combinator". What I'm really asking is if the equivalent of the following grammar would make sense
Then you could nest the |
Is there value in nesting the |
It seems simpler to me to get rid of the guard concept. A nested Once this proposal moves forward, I expect that the Really, the first reason is the big one for me. You already have a compositional notion of pattern. Use that rather than introducing a new concept. |
Thanks for clarifying. I can see arguments that suggestion that makes it more complex, and also arguments that it makes it simpler. Where do you envision the pattern grammar to find other uses? |
If short-circuiting is an argument, would there also be use cases for having an For example, something like this (not sure how the syntax would actually work) match(thing) {
when(...): ...
when(if (matcher != null) & { x: ${matcher} }): ...
} |
Two thoughts:
|
This seems answered for now; @erights, are you satisfied to close this? Or, if not, are you content to consider it a stage 2 concern as opposed to a stage 2 blocker? |
Although I do not consider this adequately answered, I agree it is not a stage 2 blocker. |
And note that we can safely add a combinator-level |
@theScottyJam, this seems easy, just add |
Why is
if
a clause guard instead of a pattern combinator, likeand
,or
, andwith
?The text was updated successfully, but these errors were encountered: