2.2. Symbols, Variables, and Evaluation

Complementing their dynamic environment and event-driven behavior, DataHub scripts have a slightly different approach to symbols and variables compared to other programming languages like C or Java.

2.2.1. Symbols and Variables

One of the fundamental units of the Gamma language, is a symbol. Symbols are made up of one or more alphanumeric characters, as well as "_". A symbol gets created whenever a unique group of characters appears in a script for the first time; from that point on the symbol is a unique object for the Gamma scripting engine. When first created, symbols are variables. The value of a variable can be assigned and reassigned at any point in the script. Variables that are not assigned a value have a default value of _undefined_.

Variable Scoping and Dynamic Typing

Similar to many programming languages, variables in the Gamma language can be local or global in scope. At the same time, to provide maximum flexibility, these variables are dynamically typed. Each time a variable is assigned a value, the Gamma engine assigns or reassigns the type for that variable, based on the new value. This facilitates rapid development and eliminates the need to type or even declare all variables before they are used. Of course, good programming principles must still be observed when writing scripts to ensure that the variables are of the correct type for the circumstances.