[Issue 24587] Allow negated qualifiers in cast expressions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 7 07:47:22 UTC 2024


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
I don't find this very useful. It seems that we are complicating the type
system only to obtain something that is actually more confusing. cast() is used
to drop all qualifiers whereas if you want to keep some of them you can just
cast to the appropriate combination of qualifiers (i.e. cast(const shared)).
That way you know exactly what the type is at the cast site, whereas
introducing the possibility to negate a single qualifier makes it ambiguous
with regards to what the type at the cast site is.

Also, can you provide a concrete code example where this is useful? It seems to
me that this is a theoretical proposal without any actual practical usefulness.

--


More information about the Digitalmars-d-bugs mailing list