std.algorithm.remove and principle of least astonishment

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Nov 22 09:07:55 PST 2010


On 11/22/10 9:37 AM, Steven Schveighoffer wrote:
> On Sun, 21 Nov 2010 23:56:17 -0500, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> If you want to work with arrays, use a[0] to access the front, a[$ -
>> 1] to access the back, and a = a[1 .. $] to chop off the first element
>> of the array. It is not AT ALL natural to mix those with a.front,
>> a.back etc. It is not - why? because std.range defines them with
>> specific meanings for arrays in general and for arrays of characters
>> in particular. If you submit to use std.range's abstraction, you
>> submit to using it the way it is defined.
>
> I want to use char[] as an array. I want to sort the array, how do I do
> this? (assume array.sort as a property is deprecated, as it should be)

Why do you want to sort an array of char?

Andrei


More information about the Digitalmars-d mailing list