Dynamic templated virtuals - I still often want them
Adam D. Ruppe
destructionator at gmail.com
Thu Jul 23 17:09:46 UTC 2020
On Thursday, 23 July 2020 at 16:06:03 UTC, Steven Schveighoffer
wrote:
> Potentially as well, you could specify overrides of the Base
> template in a derived type if needed.
Right, I'd want to do that with a normal `override` definition
just like any other method.
(semantically, the virtual template would probably work the same
as a mixin template. If you provide your own override, it just
ignores the template version using yours instead.)
> One other tricky thing is that the override functions must not
> vary the parameter or return types (except for covariance).
Yeah, it would still be subject to the same semantic checks as if
it was written by hand and would need to error there; it is still
an interface method. Though the compiler might not actually
diagnose that error until you actually try to subclass it (again,
just like the mixin template thing, just without the explicit
`mixin X`).
More information about the Digitalmars-d
mailing list