Thread overview
[Issue 5513] New: Erroneous example in std.algorithm
Feb 01, 2011
Simen Kjaeraas
February 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5513

           Summary: Erroneous example in std.algorithm
           Product: D
           Version: D2
          Platform: Other
               URL: http://digitalmars.com/d/2.0/phobos/std_algorithm#schw
                    artzSort
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody@puremagic.com
        ReportedBy: simen.kjaras@gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras@gmail.com> 2011-02-01 07:41:15 PST ---
This examples is on the std.algorithm doc page:

uint hashFun(string) { ... expensive computation ... }
string[] array = ...;
// Sort strings by hash, slow
sort!("hashFun(a) < hashFun(b)")(array);
// Sort strings by hash, fast (only computes arr.length hashes):
schwartzSort!(hashFun, "a < b")(array);

As we all know, *naryFun can't access local symbols, so this example does not compile.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5513


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-02-01 08:16:59 PST ---
This would be caught by documented unittests...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5513



--- Comment #2 from Andrei Alexandrescu <andrei@erdani.com> 2013-01-08 00:50:46 PST ---
https://github.com/D-Programming-Language/phobos/pull/1059

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5513


Alex Rønne Petersen <alex@lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |alex@lycus.org
         Resolution|                            |FIXED


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