[fpc-devel] Packages, Generics
Marco van de Voort
marcov at stack.nl
Sun Sep 12 10:04:09 CEST 2010
In our previous episode, Willibald Krenn said:
> the correctness of the use of a value with a generic type without the
> need for specialization. Here is a catch: Pascal has quite a lot of
> types that are not classes. And this makes things a bit uncomfortable.
> I would say that it is (almost) impossible to do packages in a sane way
> if we allow all sorts of operations on 'generically typed' values: If
> someone defines such a generic class, the compiler will need to
> pre-generate all possible type specializations of that class for the
> package file
No it won't. Not all of the implementation of a package needs to be in the
.BPL equivalent. Neither is the case in Delphi.
Seek for $weakpackage and read the packages wiki again
So in short, everything in the units that doesn't go into the DLL goes into
the .DCP which is more or less a dcu archive if I understood it correctly
So only the specializations used inside the code contained in the BPL (and
maybe one or two that you could force to save duplication) are in the BPL.
So in short, the problem is one that you create yourself by self-inflicting
that every piece of code _must_ be in the BPL. That isn't the case.
More information about the fpc-devel