[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
External interfaces (was OOC Core Library)
I also would like to define some interfaces to C++ classes.
In particular, it would be nice to be able to call C++ classes with no
overhead very much like a standard Oberon-2 type-bound procedure. I see
several problems with this:
1) C++ allows overloaded operators.
2) C++ allows definition of inline operators (e.g., +, -, etc)
3) C++ allows structured value returns
4) Constructors/Destructors may cause some problems
The interface to Oberon-2 would have to redefine overloaded operators
in terms of individual functions with different names. Inline operators
would be handled as shown below:
PROCEDURE ["C++", "+"] (VAR c: Complex) Plus (a, b: Complex);
where "+" is an overloaded C++ operator which works with structured complex
values. Another overloaded function in the same module would be dealt with
as:
PROCEDURE ["C++", "+"] (VAR c: Complex) PlusReal (a: Complex; b: REAL);
Anyone else have any ideas how to handle this sort of interface? As well,
does anyone know how C++ deals with class operations and how well they
would map into Oberon-2's type-bound procedures?
In general, our life would be a lot simpler if our compiler supported
structured returns. We will also have to think about how to deal with
C++ constructors and destructors. The latter implies that we have some
kind of finalization support.
Michael Griebling