- Lexical variables
- Instance variables
- This variables
- Special variables
- Property variables
Variables are identifiers prefix and/or suffixed with sigils.
Lexical variables are identified by the
Lexical variables are specific to the scope in which they are declared. Scopes which inherit from that scope can access them, but exterior scopes cannot.
Lexical variables are implemented as properties of the current scope object.
Inheritance of variables from external scopes is possible through the
same ISA inheritance system used for all objects. For this
$var is functionally equivalent to
Instance variables are identified by the
Instance variables are only valid within class methods. They refer
to properties of the current class instance. For this reason,
functionally equivalent to
Maybe don't use this. I can't decide its fate.
This variables are identified by the
This variables are valid within any function or method. They refer
to properties of the object on which the event was fired. For this reason,
%var is functionally equivalent to
*this refer to the same object. However, this is not
always the case. Within an
on block, you should always use
variables to reference the object on which the event is fired, because
will refer to the same
*self as the containing scope.
Special variables are identified by the
Special variables refer to properties of the current scope's special object. All scopes, as well as other select objects, possess a special object. However, such objects cannot be accessed directly; their properties can only be retrieved using this type of variable.
- *scope - refers to the current scope object
- *return - within a function, refers to the return object
- *class - within a class, refers to the class itself
- *self - within a class, refers to the current instance
- *this - within event callback functions, refers to the object on which the event was called
- *argv - refers to the list of arguments passed to the program
- *file - replaced at compile time with the name of the source file
- *line - replaced at compile time with the current line in the source file
Symbols are identified by the
Symbols are global objects associated with their identifiers. Therefore,
:sym is always referentially equivalent to to
:sym anywhere else. In other
words, two symbols of the same identifier are memory-address-equivalent,
:sym === :sym. Always.
Property variables are defined by the
They are tokenized separately from the normal
PROPERTY. The difference is
that normal properties can never have whitespace between the object and period.
Property variables are only valid within body of an
type, or zero-argument
function. They provide a
shorthand syntax for
$obj.property, allowing it to instead be written as just