0 Members and 1 Guest are viewing this topic.
Multi arrays with [] seems like a must. Instead of tuples, can't you just return an array?
byte (x,y) = foo(1,2);func foo(byte a, b): (byte,byte) { return (m,n);}[2]byte xy = bar([2]byte{1,2});func foo([2]byte ab): [2]byte { return [2]{m,n};}[1]byte z = boo([1]byte{1});func boo([1]byte c) { return [1]byte{m};}
By the way, even if you make the language similar to standard languages, when this comes out, you should really start writing a good tutorial for it. Preferably make one for people with no coding experience, so that for BASIC coders (the ones usually looking for alternatives) can easily pick up OPIA.
[5][Y][Z]T // Static array of 5 [Y][Z]T values [ ][Y][Z]T // Pointer to array of (some number N of) [Y][Z]T values [5,5][Y][Z]T // Static array of 5x5 [Y][Z]T values [ ,5][Y][Z]T // Pointer to an array of Nx5 [Y][Z]T values *[5][Y][Z]T // Pointer to (because of *) array of 5 [Y][Z]T values *[ ][Y][Z]T // Pointer to pointer to array of N [Y][Z]T values
[5][ ]T // Array of 5 (pointer to array of T) values [5][5]T // Array of 5 (pointer to array of 5 T) values
[L,M,N]T arr; // An LxMxN array of T values [ ,M,N]T p3 = arr; // Pointer to an ?xMxN array (3D) [ ,N]T p2 = arr; // Pointer to an ?xN array (2D) [ ]T p1 = arr; // Pointer to an (N) array (1D) p3[x,y,z] == p2[x*M+y, z] == p1[(x*M+y)*N+z] == arr[x,y,z]