Is something like this possible with Delphi? (with dynamic arrays of strings and records)
type
TStringArray = array of String;
TRecArray = array of TMyRecord;
procedure DoSomethingWithStrings(Strings : TStringArray);
procedure DoSomethingWithRecords(Records : TRecArray);
function BuildRecord(const Value : String) : TMyRecord;
DoSomethingWithStrings(['hello', 'world']);
DoSomethingWithRecords([BuildRecord('hello'), BuildRecord('world')]);
I know that it does not compile like that. Just wanted to ask if there's a trick to get something similar to that.
procedure DoSomethingWithStrings(Strings : TStringArray);will create a temporary copy of theTStringArrayparameter on the stack. You should better add aconsthere, i.e. writeprocedure DoSomethingWithStrings(const Strings : TStringArray);