|
|||||
Functions: argument separators | |||||
Prerequisite Concepts | Related Syntax |
The argument-separator depends on the type of function call.
When a function has a parenthesized argument list, the argument-separator must either be a comma (",") or an unquoted OmniMark name. The comma-and-parenthesis style is the familiar function call form used in many other programming languages.
When a function has an unparenthesized argument list, unquoted OmniMark names are used as the argument-separators. A programmer can use such separators to clarify the purpose of the arguments.
Calls to a function must use exactly the same argument-separators as in the function definition. If parentheses are present in the function definition, they must always be present in the calls to that function. If they are absent in the function definition, they must be absent in every call to that function as well.
Arguments must occur in the same order in the function call as in the function definition.
For functions which do not take any arguments, the programmer can choose either of the following forms:
define function f () as ...
define function f as ...
In the unparenthesized form of the function argument list, the programmer can specify a leading argument separator to herald the first argument. This allows a more natural syntax for some functions.
Note that a first argument separator can also be used when there is no natural choice for an unheralded first argument, or where the meaning of any unheralded argument could be ambiguous.
It is always clear whether the arguments have been specified correctly simply by reading the function call without having to refer back to the function definition. OmniMark will issue an error if the heralds are in the wrong order, and it is easy for the reader to ensure that the values passed to the function match the heralds.
Prerequisite Concepts Functions Functions: argument classes |
Related Syntax define function |
---- |