Programming Language for Old Timers


by David A. Moon
February 2006 .. September 2008

Comments and criticisms to dave underscore moon atsign alum dot mit dot edu.


Previous page   Table of Contents   Next page


Function Invocation

Invocation of a function is a four-step process:
Selection Selects the applicable subset of all the methods of the function. A method is applicable if it accepts the number of arguments that were supplied in the function invocation and if each argument is a member of the type declared for the corresponding parameter of the method. When a method has keyword parameters, the method is applicable only if each argument in a keyword position matches a keyword parameter and each argument in a value position is a member of the type declared for the corresponding keyword parameter.
Ordering Sorts the applicable methods according to specificity and categorizes them according to method options as first methods, last methods, or main methods. The details of the ordering step are explained later.
Dispatch Passes control to each of the applicable first methods, most specific first. Then passes control to the most specific applicable main method and saves the values it returns. Signal an error if there are no applicable main methods. Then passes control to each of the applicable last methods, least specific first. Finally, returns the saved values returned by the most specific applicable main method.
Execution Performs the behavior dictated by a dispatched method, which can include delegating to other applicable main methods.
Of course any of these steps can be short-circuited by compile-time, load-time, or run-time optimization.


Previous page   Table of Contents   Next page