> On Jan 8, 2018, at 5:58 PM, Sven Barth via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> FPC essentially reparses a generic during specialization so I'd say that they 
> definitely affect compile times.

Does c++  not “specialize” in one location like FPC? looking at c++ code I 
often see things like Vector<x> used in multiple locations instead of declaring 
a single type (I have no idea why they would do that but it’s very common). 
Maybe that’s why compile times are so slow?

In one instance I did something similar but hopefully it “unfolds” only once 
when the unit compiles. Is that true?

type
        generic TStaticArray<T> = class (TObject)
        end;

type
        generic TDynamicArray<T> = class (specialize TStaticArray<T>)
        end;

type
        generic TGenericArray<T> = class (specialize TDynamicArray<T>)
        end;

type
        TIntegerArray = specialize TGenericArray<Integer>;
        TLongIntArray = specialize TGenericArray<LongInt>;
        TStringArray = specialize TGenericArray<String>;
        TSingleArray = specialize TGenericArray<Single>;
        TDoubleArray = specialize TGenericArray<Double>;
        TFloatArray = specialize TGenericArray<TFloat>;
        TPointerArray = specialize TGenericArray<Pointer>;

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to