Skip to content

Commit

Permalink
language-reference: CodePointer call is prim too
Browse files Browse the repository at this point in the history
  • Loading branch information
jckarter committed Jan 15, 2012
1 parent ab458ab commit 13a560c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions doc/language-reference.md
Expand Up @@ -2593,14 +2593,19 @@ The eval expression may be a parenthesized [multiple value expression](#multiple
CallSuffix -> "(" ExprList ")" CallLambdaList?
CallLambdaList -> ":" Lambda ("::" Lambda)*

Functions are called by suffixing a [multiple value expression](#multiplevalueexpressions) in parentheses, which is evaluated to derive the function's arguments, to the function value, which is then evaluated. If the function value is a [symbol](#symbols), the argument types are matched to the symbol's [overloads](#overloadedfunctiondefinitions), and a call to the matching overload is generated.
Functions are called by suffixing a [multiple value expression](#multiplevalueexpressions) in parentheses, which is evaluated to derive the function's arguments, to the function value, which is then evaluated. If the function value is a [symbol](#symbols), the argument types are matched to the symbol's [overloads](#overloadedfunctiondefinitions), and a call to the matching overload is generated. If the function value is a value of the primitive `CodePointer` type, the pointed-to function instance is invoked.

// Example
greet(subject) { println("hello, ", subject); }

main() { greet("world"); }
main() {
greet("world");

var greetp = CodePointer[[StringConstant], []](greet);
greetp("nurse!");
}

If the function value is not a symbol, the call is transformed into an invocation of the `call` [operator function](#operatorfunctions), with the function value prepended to the argument list.
If the function value is not a symbol or `CodePointer`, the call is transformed into an invocation of the `call` [operator function](#operatorfunctions), with the function value prepended to the argument list.

// Example
record MyCallable ();
Expand Down

0 comments on commit 13a560c

Please sign in to comment.