Overview

Names inside libraries and applications are accessed with :: as follows: namespace_x::namespace_y::variable. If a name starts with :: then it represents the full absolute path starting with a library and into its nested modules. Otherwise, the system uses name resolution rules to find the corresponding namespace.

Kinds of Variables

A global variable is a variable declared within applications, libraries, and modules, but outside of any functions. Global variables comprise the data set contained within an ADAPT packet.

A local variable is a variable declared inside the body of a function. Local variables follow simple identifier rules without :: scopes.

The underscore character ‘_’ as a standalone variable name is treated as a discarded variable and does not generate an error if used multiple times.

Any variable whose name starts with underscore skips unused variable checks.

By convention, primitive function names start with an underscore.

Initializing Variables

Names must be declared and initialized using a single statement. The equals sign = declares a new name in the given scope and initializes it simultaneously:

B = "hello". // declare B with type 'string' and initial value "hello"
A is int = 1. // Declare A to be a value of type 'int' and initial value '1'

Declaration of names that contain :: results in a compile-time error.

Names cannot be redeclared in the same scope. Using ‘=’ twice with the same name in the same scope is an error. Use the mutation operator ‘->’ to change the value associated with a name.

If a name within an inner scope coincides with the name from the outer scope, the outer scope name is shadowed. Shadowing a local variable inside an if or scan statement results in a compile-time error.