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).
I agree with Frank that "Result" should behave as in Delphi and it does consistently behave there the way it was designed to, although the example shows that the whole idea of an "unnamed" Result identifier is in itself a poorly designed language feature. Obviously, not much thought went into it.
Still - what about adding a warning when "Result" is referenced in the subprocedure (or sub-subprocedure) of a function ?
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. And in this case, it is about as devious as the implicit Result variable, as the F variable definition could be arbitrarily far from the function.
Shadowing is a helpful feature, but it is not without its risks as far as robust programming goes.