[fpc-devel]Nested function as argument for TList.Sort
Jonas Maebe
jonas at zeus.ugent.be
Sun Nov 30 10:36:13 CET 2003
On 30-nov-03, at 02:29, Pedro Lopez-Cabanillas wrote:
> Of course, if the compiler doesn't support this feature, because the
> internal
> handling of function calls, a compiler error message is better than a
> program
> crash.
The problem is that some iterator-implementations do (and only) support
local functions/procedures. The collections in TP's (and as such also
FPC's) objects.pas are an example. They include special code for that
support, however. So always giving an error is going to give a lot of
false errors for people coming from TP/BP.
> But I was talking about Pascal language conventions. Instead of my code
> snippet, you can refer to the document "Extended Pascal", ISO-10206,
> chapter
> 6.11.6, examples 6-9. It's available here (among other places):
> http://www.pascal-central.com/standards.html
>
> And GPC supports this feature, see:
> http://www.gnu-pascal.de/demos/iteratordemo.pas
That's because GPC supports standard/extended Pascal, we don't. To
implement this, I think a procedure variable must always be a
pointer+it's frame pointer (nil if it's not a nested procedure), a bit
like procedure of object.
Jonas
More information about the fpc-devel
mailing list