T[new] misgivings

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 15 20:33:55 PDT 2009


Walter Bright wrote:
> Andrei Alexandrescu wrote:
>> This goes into something more interesting that I thought of after the 
>> conversation. Consider:
>>
>> T[new] a;
>> T[] b;
>> ...
>> a = b;
>>
>> What should that do?
> 
> Error. T[] cannot be implicitly converted to T[new]

Then your argument building on similarity between the two is weakened.

T[new] a;
T[] b;
...
a = [1, 2, 3];
b = [1, 2, 3];

Central to your argument was that the two must do the same thing. Since 
now literals are in a whole new league (they aren't slices because 
slices can't be assigned to arrays), the cornerstone of your argument 
goes away.


Andrei



More information about the Digitalmars-d mailing list