James Richters <james.richt...@productionautomation.net> schrieb am Mo., 22. Feb. 2021, 01:07:
> I've been using a lot of dynamic arrays of records lately, Some are even > Dynamic Arrays of records that contain other records, for example: > Type > XYZ_Record = Record > X,Y,Z : Double > End; > > Call_Stack_Record = Record > Location : LongInt; > Offset : XYZ_Record; > Rotation : Double; > End; > > Call_Stack : Array of Call_Stack_Record; > > Then I do things like: > Call_Stack[I].Offset.X := 12.345 > > Making a helper to handle "All Possible Dynamic Arrays" would have to > handle this kind of dynamic array of record structure... > No. Assuming generic helpers would be supported it would be something like(!) this: === code begin === type generic TArrayHelper<T> = type helper for array of T private function GetCount: SizeInt; inline; public property Count: SizeInt read GetCount; end; function TArrayHelper.GetCount: SizeInt; begin Result := Length(Self); end; type TLongintArrayHelper = specialize TArrayHelper<LongInt>; var arr: array of LongInt; begin SetLength(arr, 5); Writeln(arr.Count); end. === code end === In fact this is already possible for named array types. No special handling for your situation needed. And the generated code itself would be similar as well due to the inline. Doesn't change my opinion though that we don't *need* this. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal