[Issue 20670] immutable template specialization pattern matches immutable struct, strips immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 13 00:24:12 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=20670

--- Comment #8 from FeepingCreature <default_357-line at yahoo.de> ---
> D's type system currently guarantees that for all qualified types Q(T), there exists the corresponding unqualified type T.

I disagree with this claim, specifically because `immutable struct S` exists. I
don't see where D makes the claim that this is the case. `Unqual` says that it
strips type qualifiers. But `immutable struct` is not actually a qualifier,
it's an "immutable declaration." This is currently, apparently, implemented as
an implicit qualifier, which is what this bug is about, and at any rate is not
what the spec says.

What's the point of having unqualified types anyway? It's not the same as a
mutable value conversion of the type regardless. (That would require
headmutable.) So since it can't be used to make "a mutable field of T", I don't
see what this gives you.

--


More information about the Digitalmars-d-bugs mailing list