[fpc-pascal] Forward declarations

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 23 09:55:38 CET 2011


On 22 Dec 2011, at 22:24, Timothy Groves wrote:

> On 11-12-22 04:04 PM, Anton Shepelev wrote:
>> But are "mutually recursive procedures and functions" necessary?
> Not at all.

I think they are only unnecessary in the same sense that having  
procedures/functions as a whole are unnecessary, just like for/do,  
while/do, repeat/until etc:
* functions/procedures can be implemented by manually implementing a  
stack
* loops can be implemented with a combination of if/then and goto
* mutually recursive procedures and functions can be implemented by  
merging them into a single procedure/function, combining their  
parameter lists and adding a boolean to select between the code bodies  
of the two functions (or again by implementing the recursion via  
manually implemented stacks)

The fact that something can also be implemented in a different way  
does not mean it's not appropriate or even necessary to write readable  
code.


Jonas



More information about the fpc-pascal mailing list