Peter N Lewis wrote:
Why is that 'testproc' function using non-standard syntax in the first place? What is wrong with the perfectly standard (apart from function type):
function testproc (n: LongCard): String(64); begin n := n; testproc := 'OK'; end;
Agreed, " testproc := " is more readable than " return " but you left the " : String(64); " bug.
Personally, I find "return" more readable, and more maintainable since it does not require the function name embedded in the function. However, the answer to the original question is that whoever wrote testproc prefers the return syntax. If it's part of the docs, then the solution is for someone who prefers the testproc := syntax to update the docs - that's the lovely thing about open source after all...
My point is that "testproc := 'OK';" is standard, while I believe "return 'OK';" is not, certainly in ISO 7185, and I am not sure about ISO 10206. Extensions should be used for a reason, not capriciously. Borland is a hideous example.
As far as the return type is concerned, Pascal has always required a type definition for functional returns. Without such the calling code cannot even use the returned value.