Eliminate redundancy of dup/idup

bearophile bearophileHUGS at lycos.com
Sun Sep 9 10:57:45 PDT 2012


kenji hara:

> I've posted two pull requests for the purpose.

This is something related. Are your recent patches allowing code 
like this, that are two common needs?


void main() {
     auto a1 = [1, 2];
     auto a2 = [3, 4];
     immutable a3 = a1 ~ a2; // line 4
     immutable a4 = [10, 20];
     immutable a5 = [100];
     int[] a6 = a4 ~ a5; // line 7
}


test.d(4): Error: cannot implicitly convert expression (a1 ~ a2) 
of type int[] to immutable(int[])
test.d(7): Error: cannot implicitly convert expression (a4 ~ a5) 
of type immutable(int)[] to int[]

Bye,
bearophile


More information about the Digitalmars-d mailing list