Skip to content
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

Spec permits ranges to use new = and != comparison operators - but it doesn't make much sense (to me) #667

Open
StrayAlien opened this issue May 24, 2024 · 3 comments

Comments

@StrayAlien
Copy link
Contributor

Section "10.3.2.7 Ranges" permits ranges to be represented syntactically :

as a comparison operator and a single endpoint (grammar rule 7.a.)

Grammar rule 7.a now includes the = and != operators. Meaning that =10 is (according to the spec) actually a range. Same for !=10.

Single endpoint ranges for stuff like (say) <=10 make sense as the start endpoint is unbounded and now 'undefined' (refer also questions in #663. But, an equality or inequality comparison represented as a range would need to be something like [10..10] and (10..10) respectively. The endpoint is not undefined and thus =10.start would have to be 10 .. which is not what the spec says.

So ... hope that makes sense.

Kind of a bit confusing all around.

@StrayAlien
Copy link
Contributor Author

@opatrascoiu ... also something confusing re ranges. Got any thoughts?

@opatrascoiu
Copy link
Contributor

@StrayAlien

According to the spec both equality and inequality are comparison operators (see page 124 and the grammar) hence it makes sense to support them in the simple positive unary tests. After all, they are allowed in the comparison expressions.

I think that from the semantic point of view (basic maths) =10 is equivalent to >=10 and <=10 hence it is equivalent to the notation [10..10].

!= 10 is equivalent to <10 or >10 hence cannot be mapped to (10..10) which is equivalent to >10 and <10. I think that in this case the range properties (start, end & flags) cannot be defined.

@StrayAlien
Copy link
Contributor Author

Thanks @opatrascoiu - got to admit, I'm still not sure how to cover this. Or even if it is possible. The range thing is just ... well .. odd. I guess it folds in this issue also: #663. Kind of the same, so, I'll leave this ticket open for reference purposes just now, but continue on in that other issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants