D scripting

EntangledQuanta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 5 14:41:35 PDT 2017


On Tuesday, 5 September 2017 at 19:59:27 UTC, Andre Pany wrote:
> 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é

Thanks, Yeah, that is essentially what I was going to do with 
attributes, but rather than having a member do it, have a free 
function that tries to do the same thing...

But then the question remains how to output that information so 
it can then be used to link in to the "script" that will be 
compiled?


More information about the Digitalmars-d-learn mailing list