The way ARF handles return values from functions is different from other languages, and is greatly enhanced by its ability to define variables in-place. It is done by placing an arrow called a return direction after the phrase:
file.write bytes -> bytesWritten:Size err
The advantage of this is a new variable can be defined without having to
re-define and therefore shadow err
, sidestepping a major problem that Go has.
If a phrase is enclosed in brackets, the return direction arrow lies outside of them:
[file.write bytes] -> bytesWritten:Size err
Return direction cannot be used with phrases that are already being used as arguments. Its one of those things that, very elegantly, makes no sense conceptually or syntactically.
Return directions are terminated by a line break.
- Home Page
- List of Pages
- Guidelines
- Language Reference/Design Spec
- Compiler Design