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

Martin Schreiber mse00000 at gmail.com
Thu Sep 29 11:41:22 CEST 2016


On Thursday 29 September 2016 10:49:03 Graeme Geldenhuys wrote:
> On 2016-09-29 06:42, Martin Schreiber wrote:
> >  abcintf:= iabc(abc);
> > "
> > which has the best performance.
>
> But you must still remember to check if abcintf has been successfully
> assigned.
>
There will be a compiler error if "abc" does not implement "iabc".

> [personal opinion]
> Hence I still prefer the Supports(..) call as it can be used directly in
> a boolean expression, the name itself makes it very clear what you are
> asking from the code, and it just reads better.
>
Step through the code with F7 and you will see what overhead it means. AFAIK 
the compiler does not optimise for compiletime known case.

Martin



More information about the fpc-pascal mailing list