[dmd-internals] Correction to name mangling doc
Walter Bright
walter at digitalmars.com
Wed Aug 31 17:33:36 PDT 2011
On 8/31/2011 4:18 PM, Sean Kelly wrote:
> Here's one I ran across working on formatting integer literal template parameters. This declaration:
>
> void fnA(alias x)() {}
> alias fnA!([true:'a',false:'b']) fn;
>
> Is mangled as:
>
> _D8demangle24__T3fnAVHbaA2i1i97i0i98Z3fnAFZv
>
> So the template parameter type is "Hba", the list of values is "A2…" and the values themselves are all represented as integers, ie. "i1" for "true", "i97" for "a", etc. I'm inclined to say that the mangling should reflect the actual type of the values rather than using 'i' as a catch-all. Does anyone disagree? Combined with the fix for AA literals, I think the encoding should be:
>
> _D8demangle24__T3fnAVHba2b1a97b0a98Z3fnAFZv
>
As long as its decipherable, I don't see a point. Also, the mangling should be
as short as practical. Spelling out 'true' is a waste.
More information about the dmd-internals
mailing list