[fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

Sven Barth pascaldragon at googlemail.com
Wed Jan 27 17:24:06 CET 2016


Am 27.01.2016 16:51 schrieb "Maciej Izak" <hnb.code at gmail.com>:
>
> 2016-01-27 15:03 GMT+01:00 Sven Barth <pascaldragon at googlemail.com>:
>>
>> The point is that it is not necessarily guaranteed on each and every
platform that the parameter passing of a (interface) method is the same as
for a global function with an additional instance parameter. This *might*
be true for those platforms on which Windows runs and thus we need to
correctly support COM interfaces, but on other platforms this *could* be
completely different (e.g. a platform could pass the instance in a register
instead of the stack while normal functions get all their parameters from
the stack; this would totally mess up the parameters that the functions
expects).
>>
>> So if you would instead change the code to use real class instances that
implement the interfaces (they can be lazily allocated singletons or so)
then I'd definitely be inclined to include the code in trunk.
>
> FPC Generics.Default implementation is a little different than Delphi
implementation. There is no global function with additional instance/self
parameter, so I think the problem don't affect Generics.Defaults and i
don't need to change anything.
>
> All is passed as "true" self parameter, there is no fake or trick :P.
>
> All is achieved by "class function" method syntax, which always has
"self" parameter.

I'll need to look at your code again, but even for class functions the same
rules (and worries) as for normal methods apply.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160127/accef2c5/attachment.html>


More information about the fpc-devel mailing list