Add these to Phobos?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 17 07:44:59 PDT 2012


On 10/15/12 10:35 PM, Mehrdad wrote:
> On Tuesday, 16 October 2012 at 01:47:58 UTC, Jonathan M Davis wrote:
>> It should probably explain the rationale behind returning SortedRange
>> so that it's much clearer as to why you'd want to use the return value
>> rather than the original (now sorted) range.
>
>
> +1
>
> As it stands it's not at all clear from the documentation what the
> intention is, or how someone can go about sorting something without
> mutating it.
>
> Thanks for the responses.

Agreed. Part of the problem was that at the time I changed sort to 
return a value (it used to return void), severe compiler bugs forced me 
to take it out again for a while. So it's been "experimental" until it 
just silently started working and I forgot about it; and you know how 
documentation of experimental work goes...

Regarding sorted(), one possibility would be to define a lazy sorting 
routine under that name or lazySort(). It would make for a better name 
than heap(), which implements the desired functionality.


Andrei


More information about the Digitalmars-d mailing list