Frank Heckenbach wrote:
... snip ...
So I'd favour something like
const Konstant: Integer; external; asmname '_c_konstant';
(i.e., mostly like a variable). But maybe also something like this would be better:
var Konstant: const Integer; external; asmname '_c_konstant';
This would probably require less syntax contortions. But in both cases, I'd have to check if it causes any parsing difficulties.
I think it would be an impossibility. Think of something like:
CONST maxindex = 123;
TYPE anindex = 1..maxindex; myarray = array[anindex] OF whatever;
VAR array1, array2 : myarray;
and think about how you can test assignment compatability at compile time, let alone indexing range checks, if that constant can be external and defined at run-time.
I expect that:
x := array1[maxindex + 1];
should generate a compile time error.
If maxindex is a variable, then it can be external, but we can't declare the anindex and myarray types.