Virtual methods

bearophile bearophileHUGS at lycos.com
Wed Feb 3 15:44:04 PST 2010


Walter Bright:
> That's not safe because there are always opaque modules that are binary 
> only. They may derive from the class in the module - and the optimizer 
> cannot prove they don't.

This sounds like:
Lasciate ogni speranza, voi ch'entrate.

Let's try again. I think there can be two types of opaque binary only modules:
- Ones compiled from C code, or with a C interface. Such modules can't contain classes, so there is no problem with virtual functions.
- Ones compiled from D code, or that use the D code interface, that can contain and use classes and virtual calls. The language can require such modules to contain a data structure that tells the compiler what's safe to do.

Bye,
bearophile



More information about the Digitalmars-d mailing list