Skip to content
Brom Bresenham edited this page Nov 8, 2023 · 4 revisions

Syntax

$exists<<SomeTypeName>>
$exists<<TypeName(args)>>
$exists<<object.property>>
$exists<<object.method(args)>>

Description

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.

Example

class Value
  METHODS
    method to<<$Type>>->$Type
      if ($exists<<$Type(this)>>) return $Type(this)
      else                        return $defaultValue<<$Type>>
Clone this wiki locally