Pointer Variable

Gilda has a variety of features to eliminate the need for pointers in cases where they would commonly be used in other languages. When pointers are useful, they are managed through containment and restrictions. Unrestricted and unnecessary pointer usage are the source of problematic programming errors and security breaches. Gilda lets you use pointers only when you really want them.

Pointers are strongly typed, as are all Gilda variables. Variant pointers are also supported that can reference one of several different data structures. Structures can also contain pointers. Their scope is limited to methods within the class where the structure is declared. Global variables cannot be pointers.

Two types of pointers can be declared. The weaker reference pointer only allows you to read data that it points to. With a Wizard pointer you can change the data to which it points. Programmers do need to carefully manage Wizard pointers to avoid programming errors. They are generally only used locally within a procedure or managed through class encapsulation.

Since dynamic strings are a primitive type, errors due to overruns, partial copies, and string memory management are eliminated. Intrinsic string operations are easy to use and the memory for string contents is automatically managed. Improper string usage is the most common way hackers break into systems.

Procedure parameters are passed by value except for Exit parameters. Instead the compiler uses pointers under the hood when passing arrays or large data structures. Procedure signatures that contain Exit pointers are rare outside of low level code. Array bounds are checked over procedure calls using an elegant syntax. The procedure call mechanism leaves fewer opptrtunities for hackers to hijack the call stack.

Dynamic arrays can be declared local to a procedure and are allocated upon entry. They are automatically deallocated upon exit even if the procedure was exited or unwound while processing an exception. Declaring dynamic arrays this way is simple and reliable. No pointers are involved.

The need for pointer management is reduced to a few instances that can be contained with reasonable effort. Generally, this happens only when you really want to be using them for low level programming, performance, and calls to procedures in foreign languages or libraries.

Micro and Macro

Enumeration and Structure