By now you’ve noticed that BOOL uses a lot of symbols. It steals (and runs with) the ball from Perl mostly, which uses punctuation symbols to determine basic data types (scalar, array, hash, and so forth). Many forms of BASIC have also used punctuation symbols to determine data type.
BOOL uses them to define basic meta-types of objects in BOOL, and it uses them to distinguish between definitions of new objects and references to existing objects.
And while it does make BOOL have a bit of that “line noise” look that so uglifies Perl, the syntax has been there from the very beginning, so it’s not going anywhere. Consider it part of BOOL’s “charm”.
The simplest rule is that, “Two symbols together means a definition of a new object.” A single symbol indicates a reference to an existing object.
Next is the list of symbols and which BOOL meta-objects they indicate:
- @ (at-sign) — Action (a container of code; a “sub-routine”)
- * (asterisk) — Model (a container of data+code; a “class”)
- : (colon) — Message (the only symbol used post-fix)
- = (equals-sign) — List (explicit)
- . (period, dot) — List (implicit)
- ! (exclamation) — “this” object
- […] (square brackets) — Label or Index
- $ (dollar-sign) — System Model (defined only by the system)
- & (ampersand) — External Action (binding to external code libraries)
- # (hash) — Exception object
There are others, but those are the main ones.
One of the purposes of the symbols (exactly as in Perl and BASIC) is to create separate namespaces for the different meta-types. Therefore, an Action named
@foo-bar and a Model named
*foo-bar are separate objects.
And the first rule means that
@@foo-bar is the definition of a new Action meta-object (whose name is
@foo-bar). An internal BOOL Call meta-object uses the name to bind to the Action. When the Call object is executed, it “calls” the Action.
**Point is the definition of a new Model meta-object (named
*Point). An internal BOOL Instance meta-object uses the name to bind to the Model. When the Instance object is executed, it initializes a new instance of the data object.
This protocol applies to System Models and External Actions. For example,
$$file is a system definition (which may only appear in system code), and
$file is an Instance meta-object that creates a new
$file Instance Object. Likewise,
&&sleep defines (in system code only) an external function and
&sleep calls it.
Messages are a rare exception to the rule of symbols appearing as prefixes. The colon (“:”) that identifies Message meta-objects follows the word. This allows a Message to appear directly next to its target with no white-space required. The colon acts as a delimiter. This allows allows Messages to be concatenated.