Statements
Statements are used in process syntax to
- destruct values: Command
- bind values: LetStatement
Process syntax is a series of statements, where all are nonterminating. In a channel
expression the last one will be terminating, making it an exception.
Process syntax is introduced by the Proces Rule:
Syntax
Process : (Statement (;
? Statement) (;
? TerminatingStatement)?)?Statement :
Command
| LetStatementTerminatingStatement :
TerminatingCommand
It is used in the following places:
-
let x = do { process } in value
The process here may not use terminating statements.
-
let x = chan dual { process }
The process here must use a terminating statement. It constructs
x
by destructing its dual,dual
.
Let Statements
Syntax
LetStatement :
let
Pattern=
Expression
Let statements are used to create values in processes. They are the only constructive statements, as commands always destruct.
In do
expressions, they are used to bind the values used in the value after in
:
let true_and_false = do {
let x: Bool = .true!
let y: Bool = .false!
} in (x, y)!
In chan
expressions, they can be used to construct a value that is then linked with a value of dual type:
def just_true = chan return: chan Bool {
// constructing the return value
let b: Bool = .true!
// linking it
return <> b
}
// is equivalent to
def just_true = chan return: chan Bool {
// destructing the result
return.true!
}