[fpc-devel] Syntax problem with function result

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Jul 28 18:12:31 CEST 2010


On 28 Jul 2010, at 17:08, Florian Klaempfl wrote:

> Am 28.07.2010 15:10, schrieb Hans-Peter Diettrich:
>> Florian Klaempfl schrieb:
>> 
>>>> 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.
>> 
>> Can it be implemented ASAP, or is a feature request required?
> 
> If none of the other developers refuse till tomorrow, I'll apply the
> patch of Jeppe.

It should be implemented as a {$modeswitch xxx}, not as a special directive. Also, I think that only using result as an rvalue should be disabled by such a patch (more or less like it was the case in TP). Using the function name as an lvalue never causes an ambiguity, afaik.

> Anybody else opinions if a hint would be better than the mode switch?

I think a modeswitch is fine. We have a {$modeswitch result} as well (that enables the use of the "result" identifier as alias for the function result), which can be used in e.g. FPC mode in combination with this new switch.


Jonas


More information about the fpc-devel mailing list