Globals

Although discouraged in a pure Object-Oriented environment, Oxygene lets you define global members within a namespace that will be accessible from any place where the namespace is in score, without a class prefix.

This is mostly useful to define and interact with global functions on the Cocoa and Island platform where code must often interact with non-object-oriented system APIs, but also available on .NET and Java.

Internally, Oxygene will create an implied static class called __Globals that contains these members.

Forward Declarations

Though not necessary ion Oxygene, the compiler also allows forward declaration using the forward keyword. A forward declaration provides the signature of a global method without providing the implementation; the implementation of the method can then be provided further down in the same file.

Forward declarations were necessary in legacy pascal compilers due to their single-pass nature, in order to allow two methods to call each other without depending on method order within the file. With Oxygene, this is not necessary.

A forward declaration looks like a regular method declaration, with the forward Member Modifier.