Since Gamma is built on top of Lisp, all Gamma statements and expressions
are translated into lists, which represent the equivalent function call. For
example, the expression 2 + 3; is translated into the
function call (+ 2 3) at read time, and evaluated as a
list at run time. (Operators like + are functions in
Lisp.) For more details on Lisp function syntax, see Getting On_Line Help for
Functions.
When a list is submitted to the evaluator, it will be treated as either a function call or a method call. The first element in the list is evaluated, and the result examined. If the first element evaluates to a function definition, then the remainder of the list is treated as the arguments to this function, and the function is called. If the first element evaluates to an instance of a class, then the second element is evaluated.
If the second element evaluates to a class, then the third argument must be a symbol that names a method for that class. If the second element does not evaluate to a class, then it must be a symbol that names a method for the class of the instance, or a method of one of the instance's parent classes.
Once a method has been identified, the remaining elements of the list are treated as the arguments to the method, and the method is called on the instance. For example, here we call a function with the given arguments:
(function arg1 arg2...)
Here we call a method from an instance's own class.
(instance method_name arg1 arg2...)
And here we call a method from the instance's class hierarchy.
(instance class method_name arg1...)
If an explicit class is provided, it is normally a parent (base) class of the given instance. This is not enforced by the evaluator, so it is possible to call a method for an instance which is not a member of the class for which the method was defined. This is not normally a good idea, and can be highly confusing to anybody reading the code.