[fpc-devel] Newbie question: how does the compiler know the class type of an object ( the Is operator)

Marco van de Voort marcov at stack.nl
Mon Aug 25 14:49:02 CEST 2014


In our previous episode, Sven Barth said:
> > It was flagged as one of the constructs to be removed from the Delphi
> > "Nextgen" compiler. But that was all "looking at".
> 
> In Delphi they are to be considered deprecated for a long time already. But
> I don't care about that as I'm a FPC developer where they aren't
> deprecated...

I don't recommend them for any new code. 
 
> > > At least not in FPC. Also unlike records it
> > > supports inheritance.
> >
> > Limited use without dynamic instantiation.
> 
> I wouldn't say that. Even without dynamic instantiation it would at least
> allow for reduced amount of code for structures that share some fields and
> thus maybe logic...

As I said, that is a limited use :_)

But IMHO that's more trying to find uses then anything real. In practice the
record functionality superceded them.

In recent years I only used them for things like static iterator objects. 
And that code had origins before D2006 even, so maybe nowadays I would do
that with records.



More information about the fpc-devel mailing list