[fpc-devel] generics and scoping rules
pascaldragon at googlemail.com
Sat May 9 09:35:08 CEST 2015
Am 08.05.2015 23:56 schrieb "Martin Frb" <lazarus at mfriebe.de>:
> What are the scoping rules?
> TLazStorageMemBase = object
> CNT_OFFS = SizeOf(Pointer);
> DATA_OFFS = CNT_OFFS + (2 * SizeOf(Integer));
> FMem: PByte;
> function GetCapacity: Integer; inline;
> function GetCount: Integer; inline;
> generic TLazGenStorageMem<T> = object(TLazStorageMemBase)
> property Capacity: Integer read GetCapacity write SetCapacity;
> property Count: Integer read GetCount;
> 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?
I'd say that this is not intended, but I'll need to retest this with Delphi.
You forgot one very important piece of information though: what compiler
version are you using? If it's 2.6.x, then please test with 3.0.1 or 3.1.1
as there were /many/ changes since then and 2.6.4's generic support is
nothing compared to what we now have (despite there still being quite some
bugs and missing features).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel