[fpc-pascal] Interface delegates and the implements property specifier

Adriaan van Os fpc at microbizz.nl
Fri Dec 27 16:21:37 CET 2019

Ryan Joseph via fpc-pascal wrote:

> - Importing fields/properties is easy because we can just add symbols to the symbol table but I'm not sure what it means in terms of the compiler to import a method from another class. The method needs to be cloned or perhaps synthesized as I've seen the term used in the compiler.  Because the traits aren't actually allocated like a class or record we need to copy the code out into the class that uses them.

The code of a "mixin" or "trait" or "delegate" (or whatever implementing-something) can be 
referenced and it can put virtually into the namespace of an object. The one thing you cannot do 
however, is copy the code, because then the basic problem of mutiple-inheritance pops-up again --- 
which is what route for virtual methods to take in a multiple-inheritance "tree" that is no longer 
a tree but a graph. For the same reason, methods overriding methods imported from the 
implementing-something will still actually override the methods in the implementing-something, even 
if they virtually seem to be in the namespace of the importing object.


Adriaan van Os

More information about the fpc-pascal mailing list