[fpc-pascal] about interface and multiple inheritance
Marco van de Voort
marcov at stack.nl
Fri Feb 27 11:33:55 CET 2015
In our previous episode, Michael Schnell said:
> > (I don't know how Delphi implements Corba interfaces, it had a own
> > broker for some time)
> Sorry, but I feel we are loosing tack of the original focus of this
> thread: "what is a save replacement of multiple inheritance of classes ? "
> - Obviously interfaces do this job.
> - Seemingly this is independent of interfaces doing ref-counting.
> - Maybe other than with classes, ref-counting interfaces is rather safe.
Or maybe the rules are simpler, that is a matter of opinion/interpretation
> In other words: *language* disregarding external stuff interfaces might
> *additionally* be useful to handle.
Basic MI like C++ does afaik imply that both sides (that you inherit from)
are a class. Now the C++ concept of the root class is rather thin, but
that doesn't go for all languages.
IOW in Delphi speak: interfaces don't have to be implemented by a TObject.
> And hence the questions for me are
> - how are ref-counting and not ref counting interfaces distinguished
> when the programmer wants to use either type ? (and does this syntax
> make sense)
> - where/how is this clearly (disregarding external stuff interfaces
> might *additionally* be useful to handle) documented ?
I don't know. I guess Michael and Graeme are the main corba interface
consumers with the observer stuff. Maybe Martin S. uses it too.
I searched a bit in the FPC codebase, and the observers and lnet (in
utils/fppkg/lnet) seem the only places where it is used. The demo
(fcl-base/examples/dobserver.pp) for observers uses interfaces in the exact
way as you would refcounted interfaces, except of course you need to keep a
reference to the class to release memory.
More information about the fpc-pascal