[fpc-pascal] corba interfaces - is/as not working properly

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Sep 28 10:24:49 CEST 2016


On 2016-09-28 08:38, David Emerson wrote:
> I'm testing out CORBA interfaces before changing all my code to use them 
> (I would prefer not to have managed types for interfaces).

I've been using CORBA style interfaces for years, and it was always
worked well for me. I must add, I never use the is/as syntax though (for
COM or CORBA style interfaces). I always use Supports(..) as in:

 var
   h: i_hello;
 begin
   // fellow is the class instance variable.
   if Supports(fellow, i_hello, h) then
      h.hello;


The Supports(..) syntax just seems more logical to me than the is/as
syntax. The latter assumes the object "is" an instance of one of the
interfaces and simply typecasts it to a interface variable. The
Supports(..) syntax queries the object instance and asks if it supports
a specific interface.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list