Dynamic templated virtuals - I still often want them
Tove
tove at fransson.se
Thu Jul 23 10:13:52 UTC 2020
On Thursday, 23 July 2020 at 02:38:27 UTC, Adam D. Ruppe wrote:
> You might know about D's template this parameters, which adapt
> to the static type of a `this` reference on a call, or with the
> curiously recurring template pattern, which passes a derived
> class to the base class so the base class can inspect the
> derived class.
>
>
> It would just be cool if the base class template was
> automatically instantiated again for the child class, while
> still working like a normal virtual call.
Yes, please! I recall similar ideas resurfacing multiple times
over the course of at least 7 years from different people. Back
then we, didn't have a good DIP process so noone could take it to
the next level.
I am convinced this is a killer enabler feature. As it is today,
many people that has been using D for a long time have their own
more or less ugly mixin workarounds, but it's not easy for
everyone just starting with D to come up with this pattern
themselves.
More information about the Digitalmars-d
mailing list