On Monday, 27 April 2015 at 06:52:11 UTC, Manu wrote:
On 27 April 2015 at 15:58, Vlad Levenfeld via Digitalmars-d
<digitalmars-d@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.

Yeah, it is an excessive solution. I guess just wanted to talk about my thing and didn't think it through. I think laughing at and ridiculing are the same thing though. Anyway, lowering to copy built-in to the language, at least, would be pretty great. Especially if it worked like foreach and picked up local symbols, so that custom copy and map implementations could be used wherever they were defined.

Reply via email to