Menu

Syntax-Declarations

Ove Kåven

Type qualifiers

When assigning types to objects, the following qualifiers can be used.

Qualifier Description
owned Owned reference
unowned Unowned reference
const Const reference

Variable qualifiers

When defining variables and fields, the following qualifiers can be used.

Qualifier Description
static Permanent (not destroyed before program exit)
public Public access (available from anywhere)
private Private access (available only in enclosing module or class)
protected Protected access (available to subclasses of enclosing class)
extern Defined by a module written in another language
__super Custom reference to superclass instance
__vtable Custom reference to vtable

Class qualifiers

When defining classes and structs, the following qualifiers can be used.

Qualifier Description
transparent Transparent class/struct
static Inner class is independent of outer class
abstract Class can not be instantiated (must be subclassed)
final Class can not be subclassed
sealed Class can not be subclassed by any other module
public Public access (available from anywhere)
private Private access (available only in enclosing module or class)
protected Protected access (available to subclasses of enclosing class)
__rtinit Custom vtable to be allocated at runtime

Function qualifiers

When defining functions and methods, the following qualifiers can be used.

Qualifier Description
transparent Transparent function/method
static Method is independent of class instance
virtual Method is polymorphic
abstract Method must be overridden by subclasses
final Method can not be overridden
override Method is an override
public Public access (available from anywhere)
private Private access (available only in enclosing module or class)
protected Protected access (available to subclasses of enclosing class)
extern Defined by a module written in another language
meta Metamethod

Parameter qualifiers

When declaring function parameters, the following qualifiers can be used.

Qualifier Description
ref In/out-parameter (pass by reference)
out Out-parameter (pass by reference)
implicit Implicit parameter
__c_printf C printf-style format
__c_throw_arg Implicit parameter for exception passing

Related

Wiki: Syntax

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.