[fpc-devel] Syntax problem with function result
Florian Klaempfl
florian at freepascal.org
Wed Jul 28 09:35:54 CEST 2010
Am 27.07.2010 18:24, schrieb Hans-Peter Diettrich:
> I just had to chase an strange bug, in a local (nested) subroutine. When
> I made several functions (if_statement() ...) local subroutines of
> method statement(), they stopped to work properly :-(
>
> After many tries I concluded, that every (recursive) invocation of the
> "statement" method was replaced by the "statement" result.
>
> While it is possible to replace all occurences of "statement" by
> "statement()", it is not clear whether this is really the intended
> purpose of every occurence of "statement". This uncertainty prevents any
> automated refactoring of old style function code.
>
> IMO we should have at least an option, that a function name can *not* be
> used for the function result any more, for the result we have the Result
> variable. Then we can safely distinguish between function calls (by
> function name) and results (by "Result"). If ever required, local
> functions still can refer to the result of some enclusing function, by
> e.g. qualified <function_name>.Result.
>
I think for this purpose a hint is enough.
More information about the fpc-devel
mailing list