java-case icon indicating copy to clipboard operation
java-case copied to clipboard

Support alternative symbol syntax

Open bsless opened this issue 4 years ago • 3 comments

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

bsless avatar Sep 26 '21 09:09 bsless

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).

jeff303 avatar Sep 27 '21 18:09 jeff303

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.

bsless avatar Sep 27 '21 18:09 bsless

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.

jeff303 avatar Sep 27 '21 19:09 jeff303