Ion Fusion Documentation
Release 0.38a1-SNAPSHOT (2026-04-16T19:45:37.790Z)

Module /fusion/void

The singular no-value value.

The void value is used to denote "no value" and is the canonical value to return from a form when it has nothing meaningful to return. For example, (when false "hi") returns void since the truthy branch isn't taken. Definitions via define, mutation via set, and other core operations also return void. In contrast to C++ or Java, a Fusion procedure that "returns void" returns a value called "void", as opposed to no value whatsoever.

The void value can be acquired by calling the procedure void with any number of arguments, and one can check for it via the procedure is_void:

$ (writeln (void 1 2 3))
{{{void}}}

$ (is_void (void))
true

Another nothing-ish constant value is the result of a very specific code defect: accessing a locally-scoped variable before it's been defined. Here, we'll refer to this value as undef even though Fusion doesn't provide a binding with that name. The only way to generate undef is via a defective use of letrec that references one of the new bindings before its value has been evaluated. For example, this expression returns undef:

(letrec [(x y), (y 2)]
  x)

letrec first creates all the variable bindings (the left-hand sides), then evaluates the right-hand sides and assigns the results to the variables. If any of those right-hand-side expressions references a left-hand-side variable that's further down the list, it will get undef. Thus that expression is more or less equivalent to:

(let [(x UNDEF), (y UNDEF)]
  (set x y)
  (set y 2)
  x)

This is a situation that's almost certainly a programmer error, and undef is specifically intended to represent this case. It is not intended to be used like void as a generic "no value" result. Put another way: whereas void is something that is intended for applications to use (albeit sparingly), undef is something that you should never see unless there's a bug in somebody's code.

Both of these values are distinct from null (of any type) because of Fusion's goal to enable processing Ion data. Ion has null values that are distinct from "no value". For example, given the struct { f : null }, the result of getting field f (where the value is null) is quite different from the result of getting field g (where there's no value at all). Some code may need to handle those cases differently, and therefore Fusion needs a value to say "nothing is found" that's not null. That value is called void.

Along with all nulls and false, the void value is untruthy:

$ (if (void) "yes" "no")
"no"
is_void procedure
(is_void value)

Determines whether a value is the Fusion void value.

void procedure
(void arg ...)

Returns the singular void value, ignoring all args.