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

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 17 10:57:48 PDT 2014


On Thursday, 17 April 2014 at 12:38:24 UTC, Steven Schveighoffer 
wrote:
> I actually am ignorant of how this works under the hood for 
> slices, what triggers element-wise copy vs. assign.

The compiler compiles whatever compiles. Currently only one 
mistake (type) is required to compile the wrong thing. With the 
fix it would require two mistakes (type and syntax), so the 
probability of mistake will be square of current probability. If 
the second mistake (syntax) is ruled out (template), the 
probability is zero.

>> Range or array, there are still two ways how it can work. The 
>> idea is to give the choice to programmer instead of the 
>> compiler.
>
> But programmer cannot define new operators on slices.

Cannot define new, but could choose from predefined ones.


More information about the Digitalmars-d mailing list