Protocol
MTLStatement
Protocol for all MTL statements that can be executed within templates.
protocol MTLStatement : Hashable, Sendable
Overview
MTL statements form the building blocks of template bodies, defining both text generation operations and control flow constructs. Statements execute within an MTL execution context, which provides access to variables, models, indentation state, and text writers.
Overview
MTL supports several categories of statements:
-
Text generation: Output literal text or expression results
-
Control flow: Loops, conditionals, and variable bindings
-
File operations: Create and manage output files
-
Advanced features: Protected areas, macros, and traceability
Concurrency
Statement execution is coordinated through the @MainActor to ensure thread-safe access to shared execution context and writer state.
Topics
Instance Properties
Indicates whether this statement spans multiple lines.
Instance Methods
Executes the statement within the specified execution context.