Library Typedefs are fundamentally broken

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 22 16:07:34 PDT 2014


On 9/22/14, 11:56 AM, Daniel Murphy wrote:
> "Vladimir Panteleev"  wrote in message
> news:oadjpzibjneyfutoydct at forum.dlang.org...
>
>> What if you *want* a Typedef instantiation to be the same for all
>> instantiations of a parent template?
>
> Declare it outside the template and provide an alias inside.  Like you
> would with any other declaration you wanted common to all instantiations.
>
>> I think you can have both if Typedef simply takes an "ARGS...", which
>> defaults to TypeTuple!(__FILE__, __LINE__, __COLUMN__), but in this
>> case can be overridden to TypeTuple!(Foo, T).
>
> Yeah.  If it wasn't for the syntax overhead, the ideal args is something
> like this:
>
> struct MyTypedef_Tag;
> alias MyTypedef = Typedef!(basetype, init, MyTypedef_Tag);

struct MyTypedef_Tag;
alias MyTypedef = Typedef!(basetype, init, MyTypedef_Tag.mangleof);

should get you off the ground :o).


Andrei



More information about the Digitalmars-d mailing list