SAIL (programming language): Difference between revisions

Content deleted Content added
infobox
Line 61:
 
===Procedure declarations===
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 PASCALPascal 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}}.