Keywords · CALL
CALL
A CALL is a function called on its own line. Unlike every other keyword it has no keyword
word in front of it — a line that is just a function name and its arguments is a call. It
is how a body makes something happen.
Format
The grammar of a call line: a function name, then its arguments.
CALL ::= name { " " argument }
argument ::= name | constant
name ::= identifier { "." identifier }
HOLE
is written on the indented lines below.In the canonical form a call is a
FunctionCall node, tagged CALL: its functionName, any
typeArguments, and its arguments.
Usage
A CALL is a body command: it can stand on its own line anywhere a body runs — the
Root run body, a
FUNCTION body, a
REVERSE body, or the body of a
WITH.
At the Root
A call on its own line at the Root is the program's entry point.
App.Start "ready"
Inside a FUNCTION
An effect call inside a function body, run for what it does rather than a value it binds.
FUNCTION Log
INPUT Text line
Console.Write line
Inside a REVERSE
A call in a reverse body, doing work before the write-back.
REVERSE Text draft
Analytics.Track "edited"
Can Contain
A call's arguments follow it on the same line, or as an indented block when one fills a hole.
Reference arguments
A name in scope, passed straight through.
Text.Append greeting name
Constant arguments
A literal written inline at the call.
Console.Write "done"
A block filling a HOLE
When the function has a hole, the block that fills it is written on the indented lines below the call.
List.Each rows
Console.Write row
Targets
The same call, rendered to each target.
JavaScript
App.Start(message);
JSON
["CALL", "App.Start", [], [["reference", "message"]]]
Related
A CALL runs in the ROOT run body or a
FUNCTION,
REVERSE or
WITH body. A call whose result is bound to a name
is a LET instead. Its canonical shape is the
FunctionCall node. Back to
the language.