www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10318] New: Built-in array sort usage warning, then deprecation, and finally removal

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

           Summary: Built-in array sort usage warning, then deprecation,
                    and finally removal
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-06-09 14:47:09 PDT ---
I suggest to:
- Warn against usage of built-in array sort, as soon as possible (possibly in
dmd 2.064).
- In the successive dmd release to deprecate the built-in array sort.
- And then, in a successive dmd release, to totally remove it.


The built-in sort is less flexible, slower and more buggy than the Phobos sort
functions.

The various layers of a compiler (and its druntime) should be as small as
possible, to simplify compiler development, to reduce compiler+druntime source
code to work on, and to reduce druntime size.

Generally you want to put in the compiler what's hard/impossible to implement
in library code, like tuples and their syntax, and keep in library code the
rest, like the sorting.

One advantage of the built-in sort is that it induces less template bloat
compared to the Phobos sort. But this advantage is not nearly enough to justify
its presence and the problems it causes.

See also Issue 5854 and Issue 7115

Note: this is not an enhancement request because if you use the built-in sort
by mistake (you write myarray.sort and you forget to add the trailing ( ) ),
you hit bugs and problems. So at the moment I consider the built-in sort a
"bug" that should be removed.

Note: this bug report is not about the removal of the built-in array reverse.
That's a different issue, to be discussed elsewhere.

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