If you access an unset variable, you don't get a lot of information back:
>> state: ~
>> state
** Script Error: state is ~ antiform
That ~
is the quasiform/antiform of the space RUNE!:
>> quasi _
== ~
>> type of anti _
== ~{trash!}~ ; antiform (datatype)
But you're not just limited to the space RUNE! to make "unset" variables... because you can use any RUNE!.
>> state: ~#[INITIALIZE-STATE not called yet]#~
>> state
** Script Error: state is trash: ~#[INITIALIZE-STATE not called yet]#~
(This concept was originally called a "tripwire" when labeled trash was a distinct datatype from trash. But now that the _
is just the rune! for space, it unifies to where all antiform runes are just called TRASH!)
DEFAULT reacts to labeled trash like anything else, considering the variable to be "vacant"
>> vacant? $state
== ~okay~ ; anti
>> state: default [10 + 20]
== 30
>> state
== 30
Can Be Better Than A Meandering Comment!
A comment won't direct people to the relevant issue at runtime. But a well-chosen labeled trash can.
Compare:
; !!! UPARSE is not available in SYS because it is higher level. We hack it
; up so that when %uparse.r runs it pokes itself into sys.util/parse
;
parse: ~
With:
parse: ~#[higher-level %uparse.r hasn't set SYS.UTIL/PARSE yet]#~
Much better! Gives you the information you need, when you need it!
(Note: I was inspired to this concept by a style of usage @rgchris had in his scripts, using TAG!s to provide guidance for what was supposed to be filled into certain slots. I just wanted to give that some teeth, to know that the variable was conceptually unset.)