<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">James Richters <<a href="mailto:james.richters@productionautomation.net">james.richters@productionautomation.net</a>> schrieb am Mo., 22. Feb. 2021, 01:07:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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:<br>
Type<br>
XYZ_Record = Record<br>
X,Y,Z : Double<br>
End;<br>
<br>
Call_Stack_Record = Record<br>
Location : LongInt;<br>
Offset : XYZ_Record;<br>
Rotation : Double;<br>
End;<br>
<br>
Call_Stack : Array of Call_Stack_Record;<br>
<br>
Then I do things like:<br>
Call_Stack[I].Offset.X := 12.345<br>
<br>
Making a helper to handle "All Possible Dynamic Arrays" would have to handle this kind of dynamic array of record structure... <br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">No. Assuming generic helpers would be supported it would be something like(!) this:</div><div dir="auto"><br></div><div dir="auto">=== code begin ===</div><div dir="auto"><br></div><div dir="auto">type</div><div dir="auto"> generic TArrayHelper<T> = type helper for array of T</div><div dir="auto"> private</div><div dir="auto"> function GetCount: SizeInt; inline;</div><div dir="auto"> public </div><div dir="auto"> property Count: SizeInt read GetCount;</div><div dir="auto"> end;</div><div dir="auto"><br></div><div dir="auto">function TArrayHelper.GetCount: SizeInt;</div><div dir="auto">begin</div><div dir="auto"> Result := Length(Self);</div><div dir="auto">end;</div><div dir="auto"><br></div><div dir="auto">type</div><div dir="auto"> TLongintArrayHelper = specialize TArrayHelper<LongInt>;</div><div dir="auto"><br></div><div dir="auto">var</div><div dir="auto"> arr: array of LongInt;</div><div dir="auto">begin</div><div dir="auto"> SetLength(arr, 5);</div><div dir="auto"> Writeln(arr.Count);</div><div dir="auto">end. </div><div dir="auto"><br></div><div dir="auto">=== code end ===</div><div dir="auto"><br></div><div dir="auto">In fact this is already possible for named array types. </div><div dir="auto"><br></div><div dir="auto">No special handling for your situation needed. And the generated code itself would be similar as well due to the inline. </div><div dir="auto"><br></div><div dir="auto">Doesn't change my opinion though that we don't *need* this. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>