da Silva, Joe wrote:
Oops! I'm sorry, the example I gave wasn't quite right! :-(
Below is a corrected example, which I hope is both correct (per J&W) and illustrates why this insecurity was changed when Pascal was standardized :
program test; .... procedure fred (function smith : integer); var dummy : integer; begin {fred} dummy := smith('A') end; {fred} .... function one (x : boolean) : integer; .... function two (x, y : integer) : integer; .... begin {test} .... fred(one); .... fred(two); .... end. {test}
As you can see, when the procedure "fred" is compiled, the compiler does not know how many parameters "smith" has, nor what type they are. This makes it difficult for the compiler to validate the program, and just imagine what will happen to the stack - yuck! <g>
Oh dear, then it's really as bad as I'd feared. So I think we won't introduce `--wirth-pascal' in GPC anytime soon. ;-)
Does anyone know why this was so? Wirth must certainly have noticed the problem. Was he just afraid of the nested parentheses in a SP-like declaration with parameters?
Frank