Runtime Reflection using Compile Time Reflection

Adam D. Ruppe destructionator at gmail.com
Sun Apr 4 11:26:23 PDT 2010


On Sun, Apr 04, 2010 at 06:08:26PM +0000, Daniel Ribeiro Maciel wrote:
> I was thinking about something like:
> 
> auto foo = new Foo();
> auto mo = new MetaObject!Foo( foo );
> auto returnValue = mo.invoke( "aMethodName", "a param", "more params",
> 10, 20 );

I don't quite have that, but I do have a kind of starting point in my
D2 port/extension of dmdscript. http://arsdnet.net/dcode/dmdscript_d2.zip

Specifically, take a look inside the file pretty.d for the addFunction
template (line 99 for the main one, and line and 64 for a helper method).

It takes an array of dynamically typed Values from the script world, and
uses them to call a given D function, with the help of a wrapper template.

I haven't gotten wrapping classes to work yet.

Probably not terribly useful to you on its own, but maybe as a starting point
or to see how I solved a few problems that came up.

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list