SAIL (programming language): Difference between revisions

Content deleted Content added
Description: still working...
Line 19:
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}}. In order to improve performance, SAIL added two qualifiers, {{code|SIMPLE}} and {{code|RECURSIVE}}. If a procedure did not specifically say {{code|RECURSIVE}}, when the procedure was called it would not create an [[activation record]], thereby improving performance. SAIL 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, both exiting the procedure and returning to the caller, as well as 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}}
 
As a systems programming language, performance was important and to help with this, SAIL included a {{code|DEFINE}} which used string-replacement in a fashion similar to C's {{code|#define}} macros.{{sfn|Smith|1976|p=25}} A difference was that the delimiters around the substitution had to be defined, for instance {{code|REQUIRE "[]" DELIMITERS;DEFINE maxSize{{=}}|100|;}}. One common use of these macros was to define character constants like {{code|CRLF}}, as these were not part of the basic language.{{sfn|Smith|1976|p=25}} Another was to redefine the {{code|COMMENT}} statement to the shorter {{code|!}}.{{sfn|Smith|1976|p=26}}
 
The language used the left-arrow for assignment, or the underscore on platforms that did not have [[Stanford ASCII]].{{sfn|Smith|1976|p=5}} It included a number of standard functions like [[square root]], all of the common math operators, and was otherwise similar to most ALGOL derivatives for normal programming.{{sfn|Smith|1976|p=6}}