Discussion: postfix relational patterns #4110
Unanswered
alrz
asked this question in
Language Ideas
Replies: 2 comments 6 replies
-
I really don't like how the first part ( |
Beta Was this translation helpful? Give feedback.
5 replies
-
Sort of :) However, #4108 is really about expressions (not patterns), where i think there's a ton of value. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In C# 9.0 range checks can be written using multiple relational patterns:
But that might be difficult to reason about at the first glance duo to operators being directed in the same direction.
The idea here is to allow postfix relational patterns so that following is permitted:
I think this reads better as we have both range bounds in either side of the whole pattern.
Since we allow
and
andor
as identifiers, the following valid code would be ambigious with this change:as it could be interpreted as either a declaration pattern or a range check; though I think it is an acceptable breaking change.
This would be an alternative to the proposal at #4108 which is enabling something similar.
cc @CyrusNajmabadi
Beta Was this translation helpful? Give feedback.
All reactions