The Aztec Language provides a rich set of methods to operate on all primitive data types. Each primitive data type has a set of instance methods and there is also a corresponding set of VM global methods with similar functionality and argument/parameter lists. In addition, there is a corresponding set of 'compiler' methods to operate on primitive data types during "compile-time logic". This section describes all three types of methods. For convenience when referring to these method types in this documentation, the "VM global methods" will sometimes be referred to as 'global'.
As mentioned in the Aztec Language Introduction, the primitive instance methods and the VM global methods are implemented internally as VM instructions, so their use is as efficient as if the language had provided a real operator instead of a method.
Primitive instance methods can be very useful, and in many cases modify the value of the primitive object. In some cases, that is not preferable, so the global method can be used instead of an instance method. The global method typically returns a primitive object with the desired effect but does not modify the contents of the source value. Having both options provides more flexibility to the programmer, and similar names and argument lists provide consistency.
The documentation for each method in the primitive framework will show the syntax and describe the usage for all three of these implementations - the instance method, the global method and the compiler method.
Note that constructors for primitive data types can be used explicitely when defining local, global or shared data data items. Since primitive data types are values, the constructor can be used to affect the initial value for the primitive object. This approach can not be used for instance data items defined in a class, just as instance data definitions can not use an explicit initialization expression.
All compiler methods and global methods in the Aztec Primitive Framework are defined in the "aztec.system" space.
Class Hierarchy, int, float, string, bool, Enumerations, Global Methods
data<int> compiler CompilerCount1 = 100
CompilerInc(@CompilerCount1) # Increments dynamically at compile time.
data<int> Count = CompilerCount1 # Will get set with the value 101.
data<string> Name1 = "ABC"
data<string> Name2 = "ABC"
Name1.Add("DEF") # Instance method. End up with Name1 = "ABCDEF".
Name3 = StrAdd(Name2,"DEF") # Global method. End up with Name2 = "ABC" and Name3 = "ABCDEF".