Constants

Builder provides a special syntax for creating constant (immutable) bindings using the -< operator. Once assigned, constant values cannot be changed, providing safety against accidental modification.

Basic Syntax

Use -< instead of <- to create a constant binding.

PI -< 3.14159
MAX_SIZE -< 100

Expands to:

PI <- 3.14159;lockBinding("PI", environment());
MAX_SIZE <- 100;lockBinding("MAX_SIZE", environment());

How It Works

The -< operator is transformed during preprocessing into a regular assignment followed by a lockBinding() call. This prevents the variable from being reassigned later in the code.

Usage Examples

Defining Configuration Constants

API_URL -< "https://api.example.com"
TIMEOUT -< 30
DEBUG -< TRUE

# Later attempts to modify will fail
# API_URL <- "different-url"  # Error: cannot change value of locked binding

Benefits

Important Notes