New __traits

BLM768 via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 24 17:06:53 PST 2015


For a project I've been working on, I found that it would be 
helpful to have a way to determine whether a symbol represents a 
module or package. Since I couldn't find an easy way to do it, I 
forked DMD and made some tweaks. ;)

Anyway, I uncovered an interesting issue. According to my test 
program (https://gist.github.com/blm768/42f40aa5a0c49bb8bd16), 
these are the "types" of various packages/modules in Phobos:
std:
std.stdio: package, module
std.algorithm: package
std.digest: package

In other words, "std" isn't a package _or_ module, and std.stdio 
is both (even though it's just a single D source file). This 
doesn't seem quite right.

There could be an error in my patch to DMD, but I don't see where 
it could be because it's so simple. The code is at 
https://github.com/blm768/dmd/tree/new_traits if anyone wants to 
look over it.

If anyone can help me figure out what's going on, I'd greatly 
appreciate it.


More information about the Digitalmars-d mailing list