What's the deal with "Warning: explicit element-wise assignment..."

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 11:36:16 PDT 2014


On Tue, 15 Apr 2014 13:46:11 -0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Steven Schveighoffer:
>
>> On the left hand side, the [] operator is special *for arrays* in that  
>> it denotes you want to do an element-wise copy. On the right hand side,  
>> this is not the case, [] is simply an operator. It's a no-op if the rhs  
>> is an array, since [] just gets the array again.
>>
>> Requiring it simply adds unneeded hoops through which you must jump,
>
> What do you think are the reasons I suggested the enhancement for?

To make people write code the way you like? :)

Honestly, it's like you require someone to call a function like:

T foo(T)(T t){return t;}

Just so you can see the foo there. I understand the idea, but the result  
is not logical, just superficial.

-Steve


More information about the Digitalmars-d mailing list