Need runtime reflection?

lijie cpunion at gmail.com
Wed Jul 18 08:10:54 PDT 2012


On Wed, Jul 18, 2012 at 2:59 PM, Jacob Carlborg <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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120718/b861f741/attachment.html>


More information about the Digitalmars-d mailing list