const of AliasSeq is silently ignored
Alex
AJ at gmail.com
Tue Apr 9 14:41:40 UTC 2019
On Monday, 8 April 2019 at 19:56:50 UTC, Yuxuan Shui wrote:
>
> In this example:
>
> const(AliasSeq!(int, int)) a;
> pragma(msg, typeof(a)); // (int, int)
>
> This kind of make sense, since AliasSeq is not a "single" type.
> But silently dropping const seems bad, the compiler should
> probably report an error/warning in this case?
kinda makes sense and making sense are two different things. It
has to make sense to the compiler.
While I see that you want to distribute const over the list, D is
not designed to do this with anything that I know of. It could,
without issue, but one must makes sure it does not contradict any
other uses. If it doesn't then it could be a bonus feature.
Normally though one expects const to work on it's argument and so
this also suggests having a const AliasSeq. Since we can't have a
const AliasSeq there may be no issue redefining it to me what you
want.
I agree that silently dropping things are bad. D does this
sometimes and it can be a real pain.
More information about the Digitalmars-d-learn
mailing list