[fpc-devel] Local procedures as procedural parameter

olle.r at automagika.se olle.r at automagika.se
Tue Mar 15 17:55:23 CET 2005


> Let me add some more thoughts about procedural types:
>
> - I like the ability to declare procedural types, the ISO convention
> looks like one of the many incredible C hacks to me :-(

But it is standard pascal. And we need to support those zillion lines of
code out there, written in standard pascal.

> - For the restricted use of local subroutines as procedural parameters I
> could imagine a "const" prefix in the accepting procedure declaration:
>
> procedure my_fun(const pf: tfun);

This will be unclear imo, I would prefer a directive which tells what it
really is about.

> Hmm, the hidden frame parameter still will make a difference with local
> subroutines. At least in Pascal calling convention, where the arguments
> are popped by the called subroutine, not by the caller...

The pascal calling convention is not used on most modern processors, since
parameters instead are passed in registers.

> - I'd appreciate to define procedures based on procedural types as well.
> Currently a change to the procedural type requires updates of all
> derived procedure declarations. Something like:
>
> myproc: tfun =
> begin
>   blabla
> end;

This would increase the changeability but decrease readabillity of the
code. A C programmer would have liked this feature :)

Olle





More information about the fpc-devel mailing list