D scripting

Andre Pany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 5 12:59:27 PDT 2017


On Tuesday, 5 September 2017 at 19:44:40 UTC, EntangledQuanta 
wrote:
>> Just an idea for you: in delphi you can set the properties of 
>> a component (a class with runtime reflection enabled) on 
>> runtime. You can even call the methods and events of a 
>> component. I build a Delphi Bridge for D (see recent post on 
>> announce). It is almost the same scenario as here are also dll 
>> calls involved.
>> What I want to say, you could build something like the Delphi 
>> rtti for your D classes and make generic methods available via 
>> the dll interface.
>>
>
> But that would be quite a bit of work? Modifying the compiler? 
> I'm just looking for something relatively straightforward and 
> simple ;)

It is possible without modifying the compiler. In every class you 
want enable for runtime reflection you need to add a generic 
method which generates for all public properties/methods coding 
to fill/call them. It is a mix of templates and mixins.
In the end compile time reflection capabilities of D are so 
powerful that you can write runtime reflection with it.

Thanks for the tip!

Kind regards
André


More information about the Digitalmars-d-learn mailing list