[fpc-devel] generics and scoping rules

Martin Frb lazarus at mfriebe.de
Fri May 8 23:55:28 CEST 2015


What are the scoping rules?

Example:

   TLazStorageMemBase = object
   private
   const
     CNT_OFFS  = SizeOf(Pointer);
     DATA_OFFS = CNT_OFFS + (2 * SizeOf(Integer));
   private
     FMem: PByte;
     function GetCapacity: Integer; inline;
     function GetCount: Integer; inline;
.....
   end;

   generic TLazGenStorageMem<T> = object(TLazStorageMemBase)
...
     property Capacity: Integer read GetCapacity write SetCapacity;
     property Count: Integer read GetCount;
   end;


If I specialize TLazGenStorageMem in an other unit, then I get tons of 
errors, because all the privet symbols are not accessible.

Is that intended?



More information about the fpc-devel mailing list