First Draft: Implicit Conversion of Template Instantiations

Timon Gehr timon.gehr at gmx.ch
Mon Mar 18 00:38:23 UTC 2024


On 3/16/24 16:50, Walter Bright wrote:
> https://github.com/WalterBright/documents/blob/9dba63a4c2887bdb2b988c354ebb0d6bb44c4968/templatecast.md
> 
> DConf: https://dconf.org/2024/online/index.html#walterb

Keep in mind that to get rid of qualifier magic, you also have to add 
common types:

```d
struct S(T){
     T[] payload;
}

void main(){
     immutable a1 = [1,2,3];
     auto a2 = [1,2,3];
     assert(a1 == a2);
     auto s1 = S!(immutable(int))(a1);
     auto s2 = S!(int)(a2);
     assert(s1 == s2); // TODO
     auto a3 = [a1, a2];
     auto s3 = [s1, s2]; // TODO
}
```

This is a bit more tricky.


More information about the dip.development mailing list