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

Support alternative symbol syntax #1

Open
bsless opened this issue Sep 26, 2021 · 3 comments
Open

Support alternative symbol syntax #1

bsless opened this issue Sep 26, 2021 · 3 comments

Comments

@bsless
Copy link

bsless commented Sep 26, 2021

Hello, this is a cool and useful library
What do you think about supporting symbol syntax? i.e <16 means "less than 16". This lets you have intersecting ranges: (>1.8 < 16): greater than 8 less than 16
pros: more aesthetic than strings. range intersection
cons: people will get confused by directions.

Cheers

@jeff303
Copy link
Owner

jeff303 commented Sep 27, 2021

Interesting idea. It's true that in the current implementation, you can't express such a range in isolation (you would also need to add a 16+ range). At the same time, I'm having a hard time imagining a scenario where you would need to define a behavior for, say 9 through 16 but not for any other (which would presumably result in IllegalArgumentException if run on 16 or higher).

@bsless
Copy link
Author

bsless commented Sep 27, 2021

I can think of a situation:
Let's imagine some new API was added in java 11, and in Java 17 another API with better performance is available, too. Then I'd want to use the former for 11-16, and the latter for >17.
It is a slightly perverse scenario, but theoretically possible.

@jeff303
Copy link
Owner

jeff303 commented Sep 27, 2021

Yeah, so in that case you can use 11+ and 17+ under the current implementation. But I'm still open to consider your proposed syntax if people find that clearer, of course.

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