Nitpick Twisted Type Family
Nitpick introduces a unique “Twisted” data type family. These types dedicate specific bits in their binary representation to inline error tracking or metadata, intrinsically embedding the safety state directly into the data word.
1. Twisted Balanced
Binary (tbb)
The tbb family represents twisted
binary types (not ternary). They are balanced
binary integers that reserve the most negative possible
value in their range to act as an ERR sentinel.
* tbb8, tbb16, tbb32,
tbb64
Common Usage: The tbb32
type is heavily utilized internally by Nitpick’s
Result<T> system and the
failsafe(tbb32:err) handler to encode sticky
error codes natively without requiring an extra boolean flag
in memory.
Literals: Suffix with t
followed by width. Because tbb types are
binary, they are assigned using normal decimal integers
(just like standard int types).
Usage Example:
tbb32:status = 42t32; // Standard valid value
tbb32:err_state = ERR; // Setting the intrinsic sticky error bit
tbb32:neg_val = -1t32; // Standard negative value
2. Twisted Floating
Point (tfp)
Similar to tbb, these are floating point
numbers that embed twisted metadata (unifying ERR without
relying on ambiguous NaNs). * tfp32,
tfp64
Literals: Suffix with tf
(e.g., 3.14tf32).
Usage Example:
tfp64:measurement = 9.81tf64;