[fpc-pascal] problems with CORBA interfaces having no base type
graemeg.lists at gmail.com
Tue Sep 20 08:40:59 CEST 2011
Continuing my port of old Delphi code that used interfaces extensively.
Now that FPC 2.6.0 is nearing, I can play the with Interface
improvements it has.
In some of my old Delphi code, I created a generic class that takes a
generic interface via IInterface. This class was made to be reusable via
interface delegation, so I only need to implement a interface once and
use interface delegation in other classes to add that functionality. One
such example is the Observer design pattern
IObserver = interface
procedure Update(const Subject: IInterface);
How do I translate this to CORBA-style interfaces. CORBA interfaces
don't have a base type like all COM interfaces have (eg: IUnknown) or
objects have (eg: TObject).
Any ideas on how I should translate the above code? Must I use the
Pointer type again? That just looks ugly, and gives no hint to the
developer that Update() can take any interface type.
Why couldn't CORBA interfaces also descend from IInterface, but in the
case of CORBA style interfaces that doesn't mean it's a IUnknown
descendant. That way we will have a generic interface type to use in
such generic code situations.
- Graeme -
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
More information about the fpc-pascal