`RangeExpression`s with exclusive lower bounds

Ah, I was actually replying to this, it seems the context was lost:

But regarding the notation question, I'm sure the compiler could make an exception, we already have the ternary operator that is non-standard. OR maybe the requirement can be loosened?

In what way would that be more appropriate? These indicate that your range is smaller than x, which it isn't.

Well of course they are "lesser used", they don't exist! We could get by perfectly well without the normal greater than sign, not to mention "greater than or equal", and "less than or equal", but I think it would require a very strong argument not to have both. At this very basic level I think symmetry should be the default, and you'd need to motivate any asymmetry, rather than the other way around.

1 Like

How they are commonly used is precisely the inherent difference.

They do exist, just not in Swift. They are not commonly used, to my knowledge.

Every addition to the standard library must have compelling motivation. Symmetry is not sufficient; in fact, we explicitly reject additions like isNotEmpty, etc. The bar is even higher for new types, and this idea would require not just one but several. The bar is higher still for new operators, and this idea would add not one but multiple infix and unary operators. The bar is highest for changes to the basic syntax of the language. This idea would require such changes too.

Meh; yeah, I hadn’t really thought through the comment. I was just reacting aesthetically.

Withdrawn.

As far as I can see, it's only different when it comes to arrays and other integer indexed types, and there the difference stems from the way endIndex is defined. Or am I missing something?

That's not the same thing. The symmetry between a range that is open downward to one that is open upwards is complete. It's exactly like < vs >.

This is exactly what I meant by

Yes, you are missing something. It has nothing to do with whether indices are integers or not; endIndex is always defined as the "past the end" index for all collection types and is the fundamental reason why the Swift standard library provides the ..< operator.

It's not exactly like < and >, for the reason that I have just written above: how they are commonly used is precisely the inherent difference between the existing range operators and the ones discussed here.