Frank Heckenbach wrote:
Waldek Hebisch wrote:
Prof. Abimbola A. Olowofoyeku wrote:
On 18 Jun 2005 at 19:57, Frank Heckenbach wrote:
Waldek Hebisch wrote:
[...]
I think that letting an object inherit from anything should work. In fact, one of my pet ideas is to let Pascal objects inherit from other language objects and vice-versa. AFAICS inheriting from Objective C objects is one of main CW Pascal extensions.
Surely, such code could break some patterns valid in single-model programming, but people who want to stay in a single model may do it, and the others probably will find added complexity worthwile.
Seems reasonable.
Is it possible to achieve inheritance from C++ objects?
I think so. Hard, but should be doable by re-using parts of C++ compiler.
There are nasty semantic problems: -- C++ names are case-sensitive -- C++ methods may be overloaded -- C++ methods may be inline -- templates
Still, there is Objective-C++ compiler which allows mixing Objective C with C++, so the problems are solvable.
I think overloading and inlining are things some here want to see anyway. Case-sensitive names are a problem, as always, but probably solvable similar to C names (perhaps using attributes etc.). IMHO templates are somewhat orthogonal, so perhaps we should leave them out (at first).
Yes.
What about friends (maybe not a big problem), multiple inheritance, etc.? As I understand it, the virtual method calling mechanism is different because of multiple inheritance, possibly less efficent (is it?). If so, I'm a bit doubtful of changing it in GPC (at least, unconditionally), and we surely won't get it changed in G++ ...
I did not look at details of C++ method. But my impression is that there is no extra overhead when using only single inheritance. AFAICS OOP and Delphi already have multiple inheritance. Like Java it is limited to interfaces, but still it brings similar problems. So adapting C++ model my be the easiest way to implement OOP.
Concerning friends, IMHO we can ignore them. If we imlement (import) C++ ABI then C++ friends will work.