Why can't static arrays be sorted?
notna via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Oct 8 05:04:11 PDT 2016
On Thursday, 6 October 2016 at 09:23:19 UTC, pineapple wrote:
> On Thursday, 6 October 2016 at 09:17:08 UTC, pineapple wrote:
>> On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis
>> wrote:
>>>> Would just like to point out that this is design weirdness
>>>> on Phobos' part - the library I've been writing does not
>>>> have this problem.
>>>
>>> It doesn't even make conceptual sense for a static array to
>>> be a range, because you can't remove elements from it.
>>>
>>> - Jonathan M Davis
>>
>> Just because the static array itself isn't a range doesn't
>> mean that it should be necessary to do unintuitive gymnastics
>> with it just to pass it to functions like `sort`.
>
> I mean, people post here how often asking why static or dynamic
> arrays aren't being accepted by Phobos' range functions in
> their code?
>
> Maybe Phobos really ought to consider another approach.
> Accepting things that are _valid_ as ranges and not only things
> that are ranges themselves has proven to be an effective
> strategy in mach.
+1000
More information about the Digitalmars-d-learn
mailing list