I've got several constant arrays declared, and I'd like to declare more constants composed from those but I can't work out whether there's a reasonable way to do it.
const
Common_Strings : array [0..1] of string = ('foo','bar');
Extra_Strings : array [0..1] of string = ('some','extra');
What I'd like to do is one of these:
Combined_Strings = Common_Strings + Extra_Strings;
Combined_Strings = (Common_Strings, Extra_Strings);
This looks as though it should work, but is ugly to write and even uglier to maintain since my actual constants have 10+ elements:
Combined_Strings = (Common_Strings[0], Common_Strings[1], Extra_Strings[0], Extra_Strings[1]);
But in a fit of stupidity, elements of a constant array are not necessarily constant: "[DCC Error] MyFile.pas(89): E2026 Constant expression expected". Obviously if I try to assign to them I get "[DCC Error] MyFile.pas(854): E2064 Left side cannot be assigned to".
I note that it's also not possible to write:
Duplicate_Constant = Common_Strings;
("Constant expression expected". Really.)
Is there a way to compose constant arrays into more constant arrays?