Something like ADL from C++?
Alexandru Ermicioi
alexandru.ermicioi at gmail.com
Fri Dec 6 00:47:26 UTC 2024
On Thursday, 5 December 2024 at 21:58:14 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> If you are forcing users of a parent class to add the call
> explicitly into the parent, its a major pain that other
> languages simply do not have. Not to mention easily forgotten.
>
> This is what my attribute that I said I'm thinking about
> ``@reinterptAsChild`` would solve.
I'm confused for example. What is the problem you're mentioning
here?
If it is inheritance, then you either predefine the inheritance
structure through annotations just like Jakson lib in java
https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-annotations/latest/com/fasterxml/jackson/annotation/JsonTypeInfo.html, or use runtime reflection to check what child it is and use respective serializer for it that is prerecorded.
More information about the Digitalmars-d
mailing list