@phithe said:
Well, I did RTFM, and I found a solution - I used an array of TStrings. And I realise I could define a type to do it.
I hope you also realise an "array of TStrings" is an array of class instances, and so you'll have to create/free all the objects manually (unless you're doing .NET, but you'll still have to create them all).
I don't see what's wrong with using "type TDoubleStringArray = array of array of string"; especially since it's compiler-managed.
@phithe said:
My point is, if "procedure foo(array of bar)" works, and "var array of array of bar" works, then logically, "procedure foo(array of array of bar)" SHOULD work.
No, it should not. "Array of" in a routine declaration defines an OPEN ARRAY, which is not a dynamic array. Go read up on it [1].
@phithe said:
Wow. This is even more WTF. I wrote some code to test that out. Check it out:<FONT face="Courier New">
var
a : array of string; // these two are
b : array of string; // not assignment-compatible, but
c, d : array of string; // these two ARE assignment compatible</FONT>
Awesome.
Well it's rather obvious to anyone with some experience in Pascal. a and b have two separate specs, while c and d share theirs. It should be as clear as:
var
a: Type1;
b: Type2;
c, d: Type3;
@phithe said:
Yes, I understand that (now anyway). Here's what made me go WTF.
An array is an intrinsic data structure, but a multi-dimensional array is not, yet the syntax implies they are both instrinsic.
Well they are. Like I wrote above, "array of <type>" in a routine declaration defines an open array. Open arrays are created just before, and destroyed just after the call to the routine. You can pass dynamic arrays to an open array parameter, but it's handled quite differently by the compiler.