Function Invocations
Each function invocation has the following form:
<simple-identifier>(<actual-parameter>[, <actual-parameter>]*)
A function invocation consists of a function name followed by a parentheses-enclosed, comma-separated list of actual parameters.
Each actual-parameter is one of the following:
arithmetic-expression (see Arithmetic Expressions)
boolean-expression (see Boolean Expressions)
string-expression (see String Expressions).
The cost engine evaluates a function invocation by evaluating the right hand side of the function definition with a matching name, substituting the invocation’s actual parameters for the definition’s corresponding formal parameters. See Function Definitions for information on function definitions.
The ith formal parameter in the left hand side of a function definition corresponds to the ith actual parameter in the function invocation (for any positive integer, i).
The cost engine looks for a function definition with a matching name as follows:
First, the following predefined functions are considered:
o is<ArtifactTypeName>()
o getPrevToolRow()
o getNextToolRow()
o getPrevMillRow()
o getNextMillRow()
o snapDownLookUp()
o getPrevBestDiamTolRow()
o getNextBestDiamTolRow
Next, the cost engine considers functions defined in the current module (or in a file imported by the current module).
Finally, the cost engine considers other predefined functions.
Note that this means that user-defined functions override predefined functions with the same name, except for the predefined functions listed above; the functions listed above cannot be overridden.
Note that when a function invocation returns an object, it can be followed by object field access dot notation, as in the following:
myFunction(5).id
Such a construct is one form of complex-identifier. See Identifiers and Literals for more information on identifiers.
Note that CSL provides a number of predefined functions. See Predefined Functions for more information.