NULL/VOID/NONE/TRASH evolution from NONE!/UNSET!

Making Invisible Functions (e.g. COMMENT, ELIDE)

Note that VOID is only ignored in "interstitial slots" when it comes from a ghostable function (or you use the ^ operator).

e.g. at one point in time, this worked--but it no longer does:

>> 1 + comment "not ignored" 2
** Script Error: APPEND is missing its VALUE argument  ; 3

For an understanding of why it no longer works, see:

Why COMMENT Vanishes, but not EVAL of [COMMENT]?

But if you are in a non-interstitial slot and it's a function argument that is "optional", passing a VOID will opt out:

>> append [a b c] 'd comment "ignored"
== [a b c d]

None is used generically in many places when you want to opt out of things, but Void wouldn't be "substantive" enough to use at the end of an expression:

>> compose [<a> (if null [<b>] else [print "Hi!" ^none]) <c>]
Hi
== [<a> <c>]

It works around the problem that if an eval step produced VOID in that position, it would vanish (so you'd be composing in the result of the print). You can think of empty PACK!'s NONE as being like a "heavy VOID".

Allowing NULL to vanish here would be too liberal and not reveal what were likely errors. If you have something that may be NULL that you want to convert to a VOID if so, you can use OPT.

1 Like