Content deleted Content added
Line 32:
Procedures were implemented in a fashion similar to the [[C programming language]], with the return type, if any, in front of the name, for instance, {{code|STRING PROCEDURE toUpper(STRING originalStr);BEGIN...}}. Note the uncommon use of the semicolon here, whereas PASCAL would immediately follow with a block, typically a {{code|BEGIN}}.{{sfn|Smith|1976|p=21}}
In order to improve performance, SAIL added two procedure qualifiers, {{code|SIMPLE}} and {{code|RECURSIVE}}. {{code|RECURSIVE}} told the compiler that the procedure might call itself, and thus its [[local variable]]s had to be written to the stack, not just return information. {{code|SIMPLE}} did the opposite, telling the compiler that the local variables did not have to be saved, but additionally forced the procedure to have no local variables at all, did not allow {{code|GOTO}} out of the function, and could not refer to enclosing procedure's variables. These directives could avoid the requirement of filling out a complete [[activation record]], thereby improving performance.{{sfn|Smith|1976|p=22}} This also had the side-effect of meaning that variables declared within a procedure that was not marked RECURSIVE would not be reset between calls,{{sfn|Smith|1976|p=22}} acting similar to C's {{code|static}}.
AIL also included the {{code|FORWARD}} qualifier, used to insert [[forward declaration]]s, typically when two procedures call each other.{{sfn|Smith|1976|p=21}} {{code|RETURN}} worked as in C, exiting the procedure and returning to the caller, as well as optionally returning a value if the procedure uses one.{{sfn|Smith|1976|p=23}} Parameters passed to the procedures could be by {{code|VALUE}} or {{code|REFERENCE}}, the later allowing values to be passed back.{{sfn|Smith|1976|p=24}}
|