1.1.2 Language Core Extensions
Where the specification defines implicit behaviours, RD-VBA may choose to make those behaviours explicit, provided that all three of the following conditions hold:
- The underlying semantics remain unchanged.
- Existing code continues to behave identically.
- The added explicitness improves clarity, diagnostics, or tooling.
The following are language core extensions:
| Language core extension | See |
|---|---|
| The comment annotations syntax from the legacy Rubberduck VBIDE add-in. | RD-VBAL §3.0.1 Token Semantics |
| An explicit coercion operator (BinaryLetCoerceOperatorStaticSemantics), introduced for semantic disambiguation. | RD-VBAL §5.5.1 Let-coercion |
The explicit addition of runtime semantics for a unary + operator. |
RD-VBAL §5.6.9.3 Arithmetic Operators |
These extensions do not alter the language; they reveal it.
✅ A valid language core extension makes explicit what was implicit.
❌ An invalid language core extension introduces new semantics.
Valid Examples
Option Strict. A new Option Strict directive that restricts existing static and/or runtime semantics, by issuing error diagnostics or new, explicitly specified compile-time errors, is a valid language core extension. It is valid only if no new tokens are introduced without also introducing the native capability to output them as comment annotations, keeping the output strictly compliant with MS-VBAL. Compile-time error codes for language core extensions are described in RD-VBAL §1.1.4 Core Diagnostics.
Deferred types. VBA ubiquitously permits late binding and duck typing. Leveraging them to introduce and surface inherent deferred types to design-time symbols is a valid language core extension. Deferred types enable LSP-level enhanced capabilities, notably around auto-completion lists; see RD-VBAL §2.4.4 Deferred Types.
Invalid Examples
Reflection. Exposing symbols for descriptors and other internal meta-types is an invalid language core extension. Such symbols could introduce reflection semantics to the language.
Deferred execution. MS-VBAL explicitly specifies every Variant input in the MS-VBAL §6 VBA Standard Library as an expression to be evaluated. Building on this to introduce deferred execution semantics to the language (leveraging meta-types to introduce new semantics) is an invalid language core extension.
Deferred execution semantics would effectively make functions a first-class RD-VBA runtime entity that can be passed around as values. Functions should not be made first-class values without thorough consideration of the implications for the rest of the semantic model.
Platform-level Extensions
The invalid examples above are not invalid extensions in the RDCore ecosystem. Each of them could be a platform-level extension.
⏮️ RD-VBAL §1.1.1 Platform Extensions | ⏭️ RD-VBAL §1.1.3 Core Semantic Flags