Documentation Language: Swift

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

?
init(bindings:body:)

Creates a let expression.

Instance Properties

V
bindings

Variable bindings: (name, init expression) pairs.

V
body

The body expression evaluated with the bound variables.

Instance Methods

F
evaluate(in:)

Evaluates the expression within the specified execution context.

Relationships

Conforms To

See Also

Expressions

P
AQLExpression

Protocol for AQL expressions that can be evaluated within an execution context.

S
AQLNavigationExpression

Represents property navigation (e.g., object.property or object.reference).

S
AQLCollectionExpression

Represents collection operations in AQL (select, reject, collect, etc.).

S
AQLLiteralExpression

Represents a literal value (String, Integer, Boolean, Real, null).

S
AQLVariableExpression

Represents a variable reference in AQL.