[Issue 5076] std.algorithm.sorted / schwartzSorted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 24 03:06:29 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5076



--- Comment #10 from bearophile_hugs at eml.cc 2011-01-24 03:04:20 PST ---
In Python sort() is in-place. To help programmers remember this, sort() returns
None (like void in D):

>>> a = [10, 30, 5]
>>> sorted(a)
[5, 10, 30]
>>> a
[10, 30, 5]
>>> a.sort()
>>> a
[5, 10, 30]

But in DMD 2.051 std.algorithm.sort() returns the sequence sorted in-place.
Once a sorted/schwartzSorted are present, I suggest to let std.algorithm.sort()
return void, as in Python.

sorted/schwartzSorted may be tagged with @nodiscard from bug 5464 to further
help programmers remember their semantics.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list