Struct inheritance

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Dec 5 21:49:42 UTC 2024


On 06/12/2024 8:12 AM, Derek Fawcus wrote:
>     Since we don't have runtime reflection it has to be done at CT, and
>     if you have to do anything to offer it as a user, its just a NOPE
>     compared to other languages.
> 
> Given that Go and Java use a form of UDA for assisting in serialisation, 
> I don't see that the equivalent for D would be unacceptable.
> 
> One either writes complex schemes for per structure callbacks, or one 
> uses simple annotation with UDA. I know which I prefer, since it 
> involves writing less code.

I've written many serialization like libraries in D using UDA's they are 
amazing.

But you still need access to the child most type to do the introspection 
upon, and that in the case of classes means the user writing code for 
every child class.



More information about the dip.ideas mailing list