<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ryan Joseph via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Di., 16. Feb. 2021, 19:22:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On Feb 15, 2021, at 11:41 PM, Sven Barth via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-pascal@lists.freepascal.org</a>> wrote:<br>
> <br>
> Again, the point of the interface would be to control which methods and properties of the delegated type would be available. Also it would allow for seamless integration with the RTTI as it's possible to query the implemented interface of a class and to retrieve a reference to it, thus it would be possible to access this at runtime as well.<br>
> <br>
> The compiler will generate a VMT for the interface with method thunks that adjust the Self pointer so that it works correctly. The GetInterfaceByEntry function uses this static data to generate an adjusted Self value that callers can use.<br>
<br>
As far as the "default implements property" is concerned we don't actually need, or even want to utilize the interfaces themselves. The idea of leveraging the interface syntax for exporting method names is one thing but if we actually have to use the interfaces internally then we open a whole can of worms in terms of performance. Class instantiation may be taking on some significant baggage now also as the compiler sets up these interface VMT tables, even if the user never needs or wants them.<br>
<br>
For example this code should be a compile time indirection instead of a hidden interface cast, right? The method forwarding syntax which works by modifying the VMT can hopefully be done at compile time for the default property also. <br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I wasn't saying anything that contradicts this, only that the original mechanism of the delegation will be available even with the default modifier and this mechanism will in fact be necessary to access them through RTTI. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>