Well, from memory, a procedure or function parameter in J&W looked something like the following example :
program test; .... procedure fred (function smith : integer); .... function one (x : boolean) : integer; .... function two (x, y : integer) : integer; .... begin {test} .... fred(one(true)); .... fred(two(1,2)); .... end. {test}
Notice how the formal parameter in procedure "fred" is a function ("smith") of known type (integer) but unknown parameters? Dr. Wirth later decided this was unsafe, so when the ISO-7185 standard was formalised, this was changed (now the formal parameter, function "smith", must show it's formal parameters too). This also applies to ISO-10206, of course.
Joe.
-----Original Message----- From: Frank Heckenbach [SMTP:frank@g-n-u.de] Sent: Thursday, October 18, 2001 11:47 PM To: gpc@gnu.de Subject: Re: Errors and Standards (was: compiler bug)
da Silva, Joe wrote:
Correct. Conformant arrays are optional, so that isn't the *real* change to the language ... It is this :
When you have a procedure or function (A), as a formal parameter of another procedure or function (B), you must declare it's (A) formal parameters (as shown in example 6 in section 6.11.6 of ISO-10206; there's probably a similar example given in ISO-7185, although haven't looked for it).
This (declaring the formal parameter of a formal parameter ;-) wasn't required in the original language definition, in the "User Manual and Report".
What do you mean exactly? Did they allow parameter names to be omitted (syntax?), or no parameter list at all? The latter would seem strange to me since it would be type-unsafe.
Could you give an example of something that's valid in J&W, but not ISO 7185?
"Otherwise" was a common and useful extension to the language, but *non-standard*, prior to ISO-10206 (of course, Borland recycled the word "else", just to be different!).
... and to introduce yet another ambiguity into their dialect ...
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
da Silva, Joe wrote:
Well, from memory, a procedure or function parameter in J&W looked something like the following example :
program test; .... procedure fred (function smith : integer); .... function one (x : boolean) : integer; .... function two (x, y : integer) : integer; .... begin {test} .... fred(one(true)); .... fred(two(1,2)); .... end. {test}
Notice how the formal parameter in procedure "fred" is a function ("smith") of known type (integer) but unknown parameters? Dr. Wirth later decided this was unsafe, so when the ISO-7185 standard was formalised, this was changed (now the formal parameter, function "smith", must show it's formal parameters too). This also applies to ISO-10206, of course.
Do you mean the parameters given to the inner function (one, two) are already specified when calling the outer one (fred)? In this case, it's not much different than making smith type Integer, and passing the function result to fred. (Sure, there could be a difference in when and whether at all one/two are called, but unless they have side-effects, the result will be the same.)
Frank