Need runtime reflection?

Jacob Carlborg doob at me.com
Wed Jul 18 11:13:29 PDT 2012


On 2012-07-18 17:10, lijie wrote:
> On Wed, Jul 18, 2012 at 2:59 PM, Jacob Carlborg <doob at me.com
> <mailto:doob at me.com>> wrote:
>
>     I think you can pass a module to a template via an alias parameter.
>     Then the template should be able to inspect all free functions using
>     something like __traits(allMembers).
>
>
> Have a problem.
>
> --
> // file: A.d
>
> module A;
>
> // functions and classes
> --
>
> --
> // file: testtraits.d
>
> import std.stdio;
> import A;
>
> void main() {
>    writeln(__traits(allMembers, A));
> }
> --
>
> There is a compilation error:
> testtraits.d(6): Error: import A has no members
>
> If module is under a package name, it is OK, is that a bug?
>

Seems like it.

http://d.puremagic.com/issues/

-- 
/Jacob Carlborg




More information about the Digitalmars-d mailing list