D and reflection

amehat via Digitalmars-d digitalmars-d at puremagic.com
Wed May 7 09:51:08 PDT 2014


Hello everyone,

I'm working on porting a java library in D, and I stuck on a 
class because it works with the reflection.

 From what I've read on prowiki 
(http://www.prowiki.org/wiki4d/wiki.cgi?LanguagesVersusD), D can 
not do reflection, it is limited to the Run-Time Type Information 
(RTTI ) (http://dlang.org/traits.html).

Here is the piece of code that blocks me:

static {
         Class clazz = this.class;

         auto accessible2Args = new Callback(clazz, 
"accessibleProc", 2);
         auto proc2Args = accessible2Args.getAddress();
         if (proc2Args === 0) {
		(...)
	}
(...)
}

I am looking for a workaround that I have not found yet.
If someone an idea on the subject, I'm interested.

Thank you to you.


More information about the Digitalmars-d mailing list