I was poking at something today and thought that it would be really nice to have the ability to extend an array in I6, like the way tables can be continued in I7.
Given any array X, an assertion like
ExtendArray X <array_type> val1 val2 val3 ... valN;
would add those to the values in an array declaration, so for example:
Array X --> 2 4 6 8;
...
ExtendArray X --> 10 12 14;
would be equivalent to have declared only;
Array X --> 2 4 6 8 10 12 14;
It might also be nice to allow arrays declared only by size to be extended:
Array Y --> 10;
...
ExtendArray Y --> 5;
would be equivalent to:
Array Y --> 15;
The compiler would reject an ExtendArray if the array type didn’t match, or if the declaration type (i.e. size vs. list of values) wasn’t compatible. The pre-exisiting syntax for single-item lists of values for Array would also apply to ExtendArray.
The idea is to make additions to tables in the Standard Library or library extensions a little easier on authors. Would this be feasible?
The one-pass nature of the I6 compiler makes this difficult, I’m afraid. The array section of memory is constructed incrementally; the compiler assumes that every new array immediately follows the end of the last one. Retooling this to allow expanding arrays would be a big rewrite.
It’s a bit bulky that you need to declare the temporary variables g1-g8 for this and not can declare arrays inside an array in a nested way. In Zil you would define the same as: