Structure
AQLLetExpression
Represents let expressions for local variable bindings in AQL.
struct AQLLetExpression
Overview
Let expressions allow defining local variables within an expression scope, making complex expressions more readable and avoiding redundant computations.
Syntax
let var1 = expr1, var2 = expr2 in bodyExpression
Example Usage
// let fullName = firstName + ' ' + lastName in fullName.toUpperCase()
let letExpr = AQLLetExpression(
bindings: [
("fullName", AQLBinaryExpression(
left: firstNameExpr,
op: .add,
right: AQLBinaryExpression(
left: AQLLiteralExpression(value: " "),
op: .add,
right: lastNameExpr
)
))
],
body: AQLCallExpression(
source: AQLVariableExpression(name: "fullName"),
methodName: "toUpperCase"
)
)
Scoping
Variables defined in a let expression are only available within the body expression. They shadow any outer variables with the same name.
Topics
Initializers
Creates a let expression.
Instance Properties
Variable bindings: (name, init expression) pairs.
The body expression evaluated with the bound variables.
Instance Methods
Evaluates the expression within the specified execution context.
Relationships
Conforms To
See Also
Expressions
Protocol for AQL expressions that can be evaluated within an execution context.
Represents property navigation (e.g., object.property or object.reference).
Represents collection operations in AQL (select, reject, collect, etc.).
Represents a literal value (String, Integer, Boolean, Real, null).
Represents a variable reference in AQL.