> >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 
arithmetics.
Maybe in fpc it'd be in a cleaner way, but why?

Bye Uberto

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to