__traits(allMembers) and aliases

Artur Skawina via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 26 08:52:22 PDT 2015


On 08/26/15 14:42, Mike Parker via Digitalmars-d-learn wrote:
> This doesn't help me distinguish aliased function names.

[...]

> I don't want to put any restrictions on what the user can have in the module/class/struct that contains the function pointer. It's just that aliased function names pass both tests as they are synonyms for the functions they alias.

If it's just about functions then you can check identity (the address
obtained via the alias will be the same). That will also work for
other non-tls objects. It won't work for tls objects because the
compiler will (incorrectly) reject the equality check at CT.
Because of D's implicit TLS in module and static scopes, a lot of
objects will unintentionally be made thread local, so this solution
won't be practical until the compiler limitation goes away, yes.

artur 


More information about the Digitalmars-d-learn mailing list