array operations and ranges

Manu via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 26 23:51:56 PDT 2015


On 27 April 2015 at 15:58, Vlad Levenfeld via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>> Phobos containers already support the first line, and it would be a
>> natural extension to make them support the second.
>
>
> Sure, it's not complicated. It's something I had done in this other code and
> showing for example.


Yeah, see I don't feel making a simple thing like an array into
something more complex by wrapping it in templates is ever a good
thing to do.
I just think it's a missed opportunity that the compiler doesn't
support any of this in the language.

It would appear at face value to be a great opportunity for lowering.
Assignment can lower to .copy(), operators can lower to map!(...)

I can tell you, if I tried to explain to my colleagues that we should
wrap an array in a template so assignment works, they would laugh at
me, then ridicule me, and then they would dismiss D. Better to say
it's not supported than to show them that approach.


More information about the Digitalmars-d mailing list