Globals

From The Elements Wiki
(Redirected from Global Class)
Jump to: navigation, search

This is an Oxygene Language topic
 

Oxygene Language: Intro | Structured Overview | Grammar | Keywords | Functions



Although Oxygene is designed to completely object oriented (as are the underlying runtimes for the .NET and Java platforms), the language provides optional supports for Globals, that is functions, variables or constants that are not members of a class or other type.

By default, support for globals is disabled, and we encourage developers to review their decision carefully before going ahead and enabling globals – which can be done in Project Properties or via the {$GLOBALS ON} ({$G+}) Compiler Directive.

On .NET and Java, the compiler will emit an internal class called __Global in which all globals are contained. This class will only be emitted if globals are defined, and a separate class will be emitted for each namespace containing globals. This is an implementation detail, and code should not refer directly to this __Global class.

On Cocoa, globals are explicitly supported by the underlying platform (which is based on the non-object-oriented C runtime), and globals will be emitted as regular C functions, variables or constants.

See Also