[Issue 4527] writeln/typeid to not expand aliases (for string types)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 16 13:40:25 UTC 2020


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

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |pro.mathias.lang at gmail.com
         Resolution|---                         |WONTFIX

--- Comment #2 from Mathias LANG <pro.mathias.lang at gmail.com> ---
Closing as WONTFIX.

Rationale:
Aliases are defined as being "transparent". This is currently in the spec, and
what the compiler does. However people (including me) have come to expect
aliases to be retained while being transparent.
We added a bit of special-casing in the compiler to show 'string' when the type
is 'immutable(char)[]'. It didn't resolve the core issue, but it did mitigate
the problem.

However, typeid relies on the generated typeinfo. Having alias generate their
own typeinfo would bloat the binary to an impossible extent.
Bear in mind that aliases are used everywhere in the compiler, so
distinguishing between user-provided and compiler-generated aliases is a huge
undertaking. For example, the names of template parameter are aliases.

Putting aside the extremely negative impact it'd have on binary size, typeid is
not that used in modern D code, so I doubt the feature is more than a nice to
have nowadays.

--


More information about the Digitalmars-d-bugs mailing list