Peter N Lewis wrote:
Notice, though, that if it does, it's somewhat confusing (if both `foo' and `bar' are functions, one implicit `Result' probably shadows the other -- please try this case with Delphi as well), and error-prone (in your example, if you later decide to make `bar' a function with an integer type result, the code would silently change its meaning).
Actually, pretty much the same consequences happen in normal Pascal - it is a general consequence of shadowing. For example:
var F: Integer;
procedure Proc; function F: Integer; begin F := 5; end; begin end;
If you change the name of the function, with no other changes, the program will still compile but will likely not be doing what you want.
Sure, with renaming this can always happen. My point was that with `Result' it can also happen without renaming or introducing any new declaration, just by changing a procedure to a function (*without* an explicit result variable). Anyway, we'll have to live with it.
Frank