(I assume you hit the wrong reply button, and the mail was meant for the list. ;-)
J. David Bryan wrote:
But how could the compiler possibly enforce this? Binding to RAM vs. a mapped I/O port (or to ROM) would be done at link time, so must the compiler issue a warning for the "var" statement that variables must be bound to RAM? How else can we disallow such a program?
I think a "processor" according to the standard includes the compiler as well as the linker. Whether in practice a compiler alone
[Joe da Silva]
Yes, in the case of GPC, the "processor" must mean the compiler _and_ linker (it doesn't make sense to talk about just half a "processor" ;-).
So everything the linker does must be according to the standard as well. (Of course, we can't really enforce this in GPC, except telling people, don't use any weird linker scripts if you want to be conformant. ;-)
On the topic of "binding" variables, my understanding is that any variables declared in the "var" block of a program are local to the program and exist only during the execution of the program, unless they are included in the program's parameter list - just like file variables!
Suppose there is an implementation-dependent system variable called "user", that contains a string (with the user's name). Now, if the "processor" has a predefined binding for this variable, a program could reference it, _without_ defining it in the "var" block. However, if "user" were defined in the program's "var" block, then this would be a _local_ variable called "user", not the predefined system variable (assuming of course it isn't also included in the program's parameter list)!
So, in your previous example, where you defined a variable called "i" and assigned it the value 42, this variable could not have any other binding - it is simply a normal variable and must behave as such!
Then we agree.
If I understand you correctly, the following might be valid if `user' is predefined:
program Foo (Output); begin WriteLn (user) end.
That's no valid SP program because `user' is undefined, but such implementations that define it as an extension would accept it.
So, there could be programs with no parameters that "do something" (if the predefined variables are also used for output purposes), but such programs would not be strictly conformant. So, it seems again that a conformant program with no parameters is "pointless".
Frank