> I don’t get the resistance to Dave’s solution? I think it works well and much 
> more applicable.

I have two issues:

1. It's less discoverable. Someone merely *typing* `sort` into their editor 
will see `sortBy` right below it in their autocompletion list, and might 
discover it that way.

2. It forces a naïve implementation, which may not be the best idea. In the 
Perl world, for instance, we would usually use a Schwartzian transform to 
implement this, particularly if the key might be expensive to compute:

        array.map { ($0, sortKey($0)) }.sort { $0.1 < $1.1 }.map { $0.0 }

Having said that, I think both of these concerns are relatively  minor.

-- 
Brent Royal-Gordon
Architechies

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

Reply via email to