const of AliasSeq is silently ignored

Ali Çehreli acehreli at yahoo.com
Tue Apr 9 02:18:19 UTC 2019


On 04/08/2019 12:56 PM, Yuxuan Shui wrote:
> 
> In this example:
> 
>      const(AliasSeq!(int, int)) a;

I would expect that to mean a type list (int, int) that cannot be 
modified, meaning that it is not allowed to change it from (int, int).

>      pragma(msg, typeof(a)); // (int, int)

Makes sense to me.

However, there is no syntax that allows mutating an AliasSeq. In other 
words, the following doesn't compile anyway:

   AliasSeq!(int, int) a;
   a ~= AliasSeq!(double);

So, adding const to that construct does not add any meaning but not many 
people would notice it. :)

Ali


More information about the Digitalmars-d-learn mailing list