Hello,
I've put together a new safestruct gem / library [1] that collects
safe data structures (array, hash, struct)
and lets you say goodbye to null / nil (and maybe)
to fix the billion dollar mistake.
How can the code work without nil?
Let's say hello to zero :-).
The new rule for NO null/nil ever (again) is:
**All variables - including structs, arrays and mappings (hash
dictionaries) -
MUST ALWAYS get set (initialized) to ZERO (default) values.**
What's zero?
>----------------|----------------------------|
> Type | Value |
>----------------|----------------------------|
> Integer | `0` or `Integer.zero` |
> Bool | `false` or `Bool.zero` |
> String | `''` or `String.zero` |
> Array | `[]` or `Array.zero` |
> Mapping (Hash) | `{}` or `Mapping.zero` |
> Vote (Struct) | `Vote.new( 0, false, 0, '0x0000')` or `Vote.zero` |
> Address | `0x0000` or `Address.zero` or `Address(0)` |
> ... | |
>----------------|----------------------------------------------------|
Stay safe and set all your variables to zero - always, always,
always. Cheers. Prost.