Table of Contents

3.1 Attributes and Directives

Directives are non-executable statements. A directive influences the semantics of the module it is located in, or of the member it refers to.

In the AST, the base node type for directives is DirectiveNode, which derives directly from SyntaxNode (RD-VBAL §3.0.2 Node Types).

Option Statements

Directives include the Option statements:

Directive Description
Option Explicit Implicit declarations become compile-time errors.
Option Base Determines the base (0 or 1) of implicitly-sized arrays.
Option Compare Determines the comparison mode for string comparisons: Text or Binary. The comparison mode may instead be a host-defined token, which dynamically configures the comparison mode.
Option Private Module Determines the accessibility of a module.

The semantics of the Option statements are described in RD-VBAL §5.2.1 Option Directives.

Def<Type> Statements

Directives include the Def<Type> implicit definition statements:

Directive Configures implicit definitions for
DefBool VBBooleanType
DefByte VBByteType
DefInt VBIntegerType
DefLng VBLongType
DefLngLng VBLongLongType, in 64-bit environments
DefLngPtr VBLongPtrType_x86 in a 32-bit environment; VBLongPtrType_x64 in a 64-bit environment
DefCur VBCurrencyType
DefSng VBSingleType
DefDbl VBDoubleType
DefDate VBDateType
DefStr VBStringType
DefObj VBObjectType
DefVar VBVariantType

The semantics of the Def<Type> statements are described in RD-VBAL §5.2.2 Implicit Definition Directives.

Other Directives

Directives also include the Implements and Attribute statements:

Directive Description Described in
Implements Specifies that the (class) module implements an interface class. RD-VBAL §5.2.4 Class Module Declarations
Attribute Specifies flags and modifiers that alter the semantics of a module or member. RD-VBAL §3.1.1 Attributes

⏮️ RD-VBAL §3.0.3 Binding Contexts | ⏭️ RD-VBAL §3.1.1 Attributes