[fpc-pascal] Implicit generic specializations
ryan at thealchemistguild.com
Mon Dec 3 03:14:17 CET 2018
> On Dec 2, 2018, at 10:53 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> Specialization is expensive. If specialization can be avoided, it should be. Not to mention that the non-generic one could have more optimized code.
> Though to be sure I'll test with Delphi, we'll have to be compatible there anyway.
I think the “dummy” sym which is added after the generic procedure is overwriting the existing symbols. In the example below (my code disabled now) DoThis gives an error because it thinks DoThis is the dummy sym. If we want this to work the dummy needs to keep track of existing procsyms, unless there’s another way to get that information?
Personally I’m fine with this because I didn’t expect to be mixing generic procedures anyways.
generic procedure DoThis<T>(msg:T);
DoThis('a’); // ERROR: "Generics without specialization cannot be used as a type for a variable"
More information about the fpc-pascal