2.3.1 Composition Root
The environment host is the composition root of an RD-VBA application. It is responsible for:
| Responsibility | See also |
|---|---|
| Composing an RD-VBA application from its references, instructions, and symbols. | RD-VBAL §2.3.1.2 Session Services |
| Configuring the implicit storage of the host VBA environment. | RD-VBAL §2.1 Implicit Storage |
| Loading any application settings and additional workspace resources into the runtime environment. | RD-VBAL §2.1 Implicit Storage |
Startup sequence
- The environment host composes the application, as above.
- The environment host resolves an entry point.
- The environment host initiates an execution session (RD-VBAL §2.3.1.1 Execution Session).
- The environment host constructs an ICallStackFrame and pushes it to the evaluation engine.
- The evaluation engine sequentially evaluates each instruction in the pushed frame (RD-VBAL §3.5.4 Execution).
Symbol composition
A session is composed from several symbol providers, each an ISymbolProvider: configuration flags, AST declarations, reflected referenced libraries, and the environment host's own runtime and standard library (RD-VBAL §6.0 Standard Library).
The composition root defines each Symbol a provider yields:
| Context | Each provided Symbol is defined into |
|---|---|
| Static | The semantic layer. |
| Runtime | The session symbol table, through ISessionSymbols.TryDefine. |
See RD-VBAL §2.3.1.2 Session Services for ISymbolProvider and the session symbol table.
Expression evaluator wiring
RuntimeExpressionEvaluator.ProcedureInvoker and RuntimeExpressionEvaluator.LetCoercionProvider are settable
properties, not constructor parameters. They are assigned after every other collaborator is composed.
The evaluator exists before its invoker is built, because RuntimeProcedureInvoker needs a ProcedureExecutor,
built from a StatementRuntimeSemanticsProvider, which is itself built from the same RuntimeExpressionEvaluator.
See RD-VBAL §5.3.1.11 Procedure Invocation Argument Processing
for procedure invocation.
In this section
| § | Title |
|---|---|
| 2.3.1.1 | Execution Session |
| 2.3.1.2 | Session Services |
| 2.3.1.3 | Name Resolution |
⏮️ RD-VBAL §2.3 Application Host | ⏭️ RD-VBAL §2.3.1.1 Execution Session