New __traits

BLM768 via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 25 11:18:25 PST 2015


On Wednesday, 25 November 2015 at 15:39:17 UTC, Daniel Murphy 
wrote:
>
> What you're seeing is just an artifact of how dmd's internals 
> work. 'std' is an 'import' (call Dsymbol.kind() for the 
> category of symbol) and you'll have to resolve it to work out 
> which module/package is being imported.  It's possible that 
> this is a bug in the symbol resolution, and that it should have 
> already been resolved to a package.
>
> Keep in mind also that isPackage and isModule are RTTI 
> functions, and since Module inherits from Package all modules 
> will appear to be packages if that's all you check.

That helps immensely! I'll play with that a bit.

As far as semantics go, if this were ever officially integrated 
into DMD, would it make sense for __traits(isModule, somePackage) 
to return false (unless it has a package.d) since the inheritance 
of Module from Package is basically a DMD implementation detail, 
or would it be better to just follow DMD's convention directly?



More information about the Digitalmars-d mailing list