Inert Value
A value of the expected type, but intentionally selected to avoid meaningful execution.
function doSomething(items) {
items.forEach(() => { /* code */ });
}
In the case of our hypothetical Javascript function doSomething
, an empty array would be considered an inert value. This would be true anywhere that an empty array would fail to prompt meaningful action.
An Inert Value is distinct from a nil value, in that a nil value requires conditional branching in order to avoid execution, whereas inert values naturally avoid execution as a product of their identity. The Maybe Monad is an excellent example of a language replacing what would normally be a nil value with an inert value. Inert Values may be returned by routines that have failed their task, circumventing the need to throw an exception or return nil. [[20200315183952]]
Sometimes called Null Type, in the case of object oriented programming.
#software