Standard Library · expr
class Node
The base class of every node in the reification tree.
since 0.1.0-alpha.1linuxwindowswasm
Overview
Node carries no data of its own. A walker holds nodes as Node and uses match to find out which concrete kind it has.
Examples
Telling node kinds apart
string kind(expr::Node n) {
match (n) {
expr::Field => { return "field"; }
expr::Lit => { return "literal"; }
else => { return "other"; }
}
}
console.writeln(kind(expr::Field(["age"])));
console.writeln(kind(expr::Lit(3)));
console.writeln(kind(expr::Node()));
field
literal
other
See also
- Expr — A lambda together with a walkable description of its body.