Sorry if I wasn't clear ... when I said "my understanding is ...", what this meant (and BTW, I thought this would be clear from the subject being discussed) was "my understanding of the standard(s) is ...".
So, if you have specific areas where you believe that I have contradicted the standard(s), please indicate the particulars, so we can both double-check it.
BTW, you should note that we are in agreement that a program without a parameter list is perfectly legal. As to whether such a program is "pointless", please note that any such inference (which arose when I semi-quoted Peter Grogono), was nothing more than a bit of humour.
Now, specific to your situation, a very quick check of the ISO-10206 standard revealed the following :
Technical development section : d) Binding of variables. -A variable may optionally be declared to be bindable. Bindable variables may be bound to external entities (file storage, real-time clock, command lines, etc.). Only bindable variables may be so bound ...
6.2.3.5 section : .... Each variable contained by an activation of a block or module, unless it is a program-parameter or module-parameter, shall be created not bound to an external entity ....
6.7.5.6 section : Binding procedures ... {stuff about "bind" ...}
I'm sure there's plenty of other stuff in the standard relevant to this, of course. Like I said, this was just a quick check ...
Joe.
-----Original Message----- From: J. David Bryan [SMTP:dbryan@bcpl.net] Sent: Tuesday, October 23, 2001 1:26 AM To: GNU Pascal List Subject: Re: Errors and Standards (was: compiler bug)
On 22 Oct 2001, at 15:43, da Silva, Joe wrote:
On the topic of "binding" variables, my understanding is...
It is not my intent to argue simply for the sake of arguing. Honestly! But if we're going to decide Pascal issues on the basis of understandings and beliefs, then why have standards?
I have found over time that many of my understandings as to how things work turn out to be wrong when I examine the systems in detail. Here, fortunately, we do not have to decide how Pascal works by trial and error.
We have a standard that says explicitly how things are supposed to work.
I plead that we cannot make GPC standards-compliant if we base its operation on our belief and assumptions. Instead, we must structure GPC's
operation strictly according to the semantics outlined in the relevant standards -- at least, we do if we want to claim compliance.
...this variable could not have any other binding - it is simply a
normal
variable and must behave as such!
Can you support the "must" with a citation from the standard?
I work with embedded systems, i.e., microprocessor-based controller cards.
I develop these "bare board" controllers using Pascal, specifically, on an
HP development system. On that system, the Pascal compiler separates the program code and static data (i.e., main block-level data). It does this so that the code may be burned into ROM.
The particular processor that I target, the Motorola M68K family, has no I/O instructions. All I/O is memory-mapped, i.e., I/O is performed by normal reads and writes to address locations that are mapped to specific hardware registers instead of RAM. Because there is no controlling operating system on these boards, there is no implementation of program parameters (because there is nothing "outside" of the program).
So in this application, I/O devices are represented in the Pascal programs
as main block-level variables. A serial port configuration register might
be mapped to an "integer" variable, for example. The actual mapping of variables to devices is done by the linker, which allows the specification
of the addresses at which the variables are to be assigned.
So the programs that control these boards have no program parameters and no "read" or "write" calls; they control the machines in which they are embedded through the mechanism of variable mapping. These programs cannot
be classified as "pointless."
But are they legal Pascal? That is, do they conform to the syntax and semantics of the standard?
They conform to the syntax, surely (e.g., GPC compiles them without complaint). As far as I can determine, they conform to the semantics as well, i.e., they obey all of the rules in the standard. The standard requires certain semantics for, e.g., integer variables (scope rules followed, arithmetic behaves as expected, etc.), and all of those rules are followed by the hardware as well. I do not see anything in the standard that precludes the implementation of variables in hardware devices, rather
than in RAM, as long as the semantics listed in the standard are obeyed.
As I've noted, I would be pleased if someone could cite a section of the standard that says that a Pascal program constructed as above is illegal.
My "understanding" is that my program is legal, but with such a citation, I would withdraw that assertion. But I regret that simply saying that such a program seems to be illegal, or isn't normal, or ought to be prohibited, just isn't good enough if the goal here is to make GPC conform strictly with the ISO standards.
And that's the only point I'm trying to make: whether you or Frank or I believe that a given program is "pointless" isn't the issue. The only issue is whether the standard prohibits it, and the standard itself is the
only authority on that matter. Any discussion of what GPC must or must not do has to be supported by the standard.
-- Dave
On 23 Oct 2001, at 11:44, da Silva, Joe wrote:
Sorry if I wasn't clear ... when I said "my understanding is ...", what this meant (and BTW, I thought this would be clear from the subject being discussed) was "my understanding of the standard(s) is ...".
I understood what your understanding was. ;-) My assertion is that understandings of the standard don't count, only statements from the standard do.
So, if you have specific areas where you believe that I have contradicted the standard(s), please indicate the particulars, so we can both double-check it.
I can't, because I believe that you have asserted a restriction that is not in the standard (but see my comment about "the standard" below). I can't cite a passage from the standard that specifically allows linking of non- program-parameter, main-block variables to external entities, because the standard says nothing about such linking (allowed or disallowed). Can you cite a passage that disallows such use?
BTW, you should note that we are in agreement that a program without a parameter list is perfectly legal.
Duly noted! ;-)
As to whether such a program is "pointless", please note that any such inference (which arose when I semi-quoted Peter Grogono), was nothing more than a bit of humour.
The issue for me is not whether certain programs are or are not pointless. My contention is broader, specifically, that any such assertion must be supported by the standard and not simply by "common sense." The Pascal standards are written in horribly arcane language to ensure that they are not open to such interpretations, i.e., that everything stated is unambiguous. We shouldn't have to argue about whether a given program is or is not legal (or pointless), because the standard should either prohibit it or not.
Given the choice, I would much rather decide things on the basis of opinions and common sense, as reading the standards always gives me a severe headache. But I believe that we cannot do that, if GPC is to claim adherence to those standards. If there is disagreement over positions that GPC should take, then the choice of position must be the one that is supported by citations from the standards.
Now, specific to your situation, a very quick check of the ISO-10206 standard revealed the following...
Ah, but the assertion regarding "pointlessness" (i.e., that a program without program parameters could have no side effects) was made in the context of ISO 7185. Frank allowed that ISO 10206 programs could have side effects without program parameters (and is supported by the passages you cite).
I concur completely with your citations in the context of ISO 10206.
However, ISO 7185 mentions binding to external entities only with reference to program parameters (section 6.10). I contend that 6.10 applies only to main block variables that are also program parameters and therefore is not applicable to (and therefore does not restrict) other main block variables being bound by some other mechanism external to the language.
-- Dave