[fpc-devel] Syntax problem with function result
DrDiettrich1 at aol.com
Tue Jul 27 18:24:07 CEST 2010
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.
More information about the fpc-devel