> On 22 déc. 2015, at 19:40, Dave Abrahams <[email protected]> wrote:
> 
> It’s very convenient for “<“ to correspond to the standard strict-weak 
> ordering for a type where possible.  

Convenient maybe. Is it advisable for a standard library feature? Doubtful.

This is about the definition of <. It means “less than”.
This is why operator overloading has a bad reputation.

I don’t dispute the *usefulness* of the proposed feature; I dispute its 
proposed *name*.
Is ordering tuples needed so often that unclear nomenclature is advisable? No!

Back to fundamentals: (slightly paraphrased from api-design-guidelines)
- Clarity at the point of use is most important.
- Clarity is more important than brevity.
- Promote clear usage.

< does *not* mean “is ordered before”.
< does *not* have a clear meaning with composite data.

isOrderedBefore is a clear name.

I know that Comparable is documented with respect to sorting; it is 
unfortunate. Sortable would be a better name, given the way it is documented. 
Note that (apart from String) the concrete Comparables in the stdlib are 
numbers, stand-ins for numbers (index) or entities referenced by numbers (code 
points). String is the salient exception.

The proposed change would redefine < and would be against convention.
Highly unclear.

Cheers,
Guillaume Lessard

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to