-
Notifications
You must be signed in to change notification settings - Fork 8
$exists
Brom Bresenham edited this page Nov 8, 2023
·
4 revisions
$exists<<SomeTypeName>>
$exists<<TypeName(args)>>
$exists<<object.property>>
$exists<<object.method(args)>>
Templated meta-command that evaluates to true
or false
depending on whether the enclosed access commmand is valid. Valid access commands are TypeName
, Constructor(...)
, and object.access(...)
.
This can be paired with a standard if
or elseIf
to perform conditional compilation, as if
bodies are discarded without being resolved if the condition evaluates to false
. Particularly useful with templated definitions.
class Value
METHODS
method to<<$Type>>->$Type
if ($exists<<$Type(this)>>) return $Type(this)
else return $defaultValue<<$Type>>