[fpc-devel] problem with "is" operator

Uberto Barbini uberto at ubiland.net
Mon Apr 18 22:32:00 CEST 2005

> >Sometimes I added a GetUnderObject() to my interfaces to get the actual
> >object. But it's a choice up to the interface author.
> >BTW I needed it to release the object through the interface.
> >I suspect that if you shouldn't ever need to know the actual class when
> > using interfaces (maybe apart debug reasons).
> I don't agree with you fully. Let's have a look at java, its
> "instanceof" semantic is complete. But the "is" semantic of FPC is not
> complete.
> What you said maybe true in design patterns, but not so true in language
> sematics.

Java, .net, python use "late binding". Delphi, fpc and C++ no.
"late binding" is very useful but definitely slow.
Maybe Delphi interfaces could have retained a pointer to the underlying 
object, but they didn't.
As a matter of fact there was an article on DelphiMagazine to show how to grab 
the vmt of the object of an interface, via dirty magic of pointers 
Maybe in fpc it'd be in a cleaner way, but why?

Bye Uberto

More information about the fpc-devel mailing list