The Dot “.” Operator

Within GPL, a period character “.”, also known as the dot operator, serves as a preface character to identify a member of a class or an object.  To access a specific member of an object or class, you would write:

 object.member  or  class.member

For global classes, since there are no objects, only the “class.member” form of reference can be used.  For non-global classes, most references are to the values of objects and are written as “object.member”, although the “class.member” form is permitted for certain methods.

By making use of the dot operator, properties of objects can be used in assignment statements and expressions in exactly the same manner as you would employ any other variable of the same data type.  Also, the dot operator permits methods to be invoked in the same manner as you would invoke any subroutine or function.

Some examples of the dot operator are as follows:

Dim Pos_x, Value As Double
Pos_x = location_object.X+2 ' Get x-axis displacement + 2
location_object.X = 3 ' Set x-axis displacement property
Value = Math.Sqrt(3) ' Sqrt is method of Math Class
location_object.Here ' Invoke method to record position

The dot operator can be used multiple times in succession if a property or method returns another object.  For example, the method that inverts a Location returns a Location value.  Therefore, the following could be written to first invert a Location and then extract the x-axis displacement of the result.

Pos_x = location_object.Inverse.X