tokay
tokay copied to clipboard
Enforcing `void` value paradigm
Similar to JavaScript, Tokay has two atomics to define an empty value.
-
void
is intended to define a value which isn't there -
null
is a defined empty value
This concept is currently not enforced in Tokay. Here's an example:
- dict_pop (#75) does it right, and returns a default (defaults to void) in case a value doesn't exist
- list_pop (e9e63f5ce41ef73ee5d44789faa96e514c477e00) does it wrong, and throws an error when trying to pop something off an empty list
There are several more, related methods currently available. General rules relating void:
- void shall be returned when it doesn't exist
- when something is set to void, it shall be removed, emptied or similar
#80 entirely enforces this paradigm, setting an item to void removes it, a non-existing item produces void.