introspection experiment

Adam D. Ruppe destructionator at gmail.com
Tue Jun 14 07:36:40 PDT 2011


While my code is ugly as sin, it might be useful to look at the
prepareReflection function in my web.d

http://arsdnet.net/dcode/web.d


It uses the derived members trait to loop through them all, and
create a runtime delegate that converts a string hash into it's
arguments and it's return value into a variety of formats.

End result is you can do:

reflection.objects["Foo"].functions["ABC"].dispatcher(...);

to call the function. It's got some assumptions in there to work
with web urls and returns things wrapped in json values, but the
bulk of it might be useful to you.


More information about the Digitalmars-d-learn mailing list