On Thursday, 15 November 2018 at 19:01:45 UTC, Ali Çehreli wrote:
On 11/15/2018 09:14 AM, Carl Sturtivant wrote:
> opDispatch is special in that it allows for functions to be
added to a
> class or struct when undefined overtly but used elsewhere but
it seems
> those functions sadly are final.
>
> Can anything useful be done to remedy the situation?
For the compiler to be able to make all opDispatch
instantiations virtual, it would have to first see all calls
that generate opDispatch instantiations. (Impossible in the
presence of separate compilation.)
Only then the compiler would know how large the vtbl of the
base class should be and what member functions of the derived
class are overrides of those virtual functions.
I suppose it's such administrative difficulties that led to D
defining anything that might conceivably be overridden to be
virtual, whether or not actually overridden.