Swift standard library reference should specify whether sort() is stable

Originator:brent
Number:rdar://17570356 Date Originated:06-Jul-2014 03:32 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode6-Beta2 (6A216f)
Classification:Enhancement Reproducible:Always
 
Summary:
The Swift standard library reference should state whether sort()’s algorithm is stable or not.

Steps to Reproduce:
1. Write a pair of sort()s, as in <https://devforums.apple.com/thread/234618>.
2. Wonder if the code will work the way you intend.
3. Look it up in the Swift documentation.

Expected Results:
The documentation specifies this behavior.

Actual Results:
It does not. You’re left to wonder. (It turns out it’s not stable.)

Notes:
It’s perfectly acceptable for Swift to use an unstable sort, but that fact ought to be part of the sort function’s contract.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!