3 ms·
I've occasionally thought that if I were to design my own language, it would be nice to try using INT_MIN as the invalid value that marks None. I've never actua
by slavik81 8y ago
I've occasionally thought that if I were to design my own language, it would be nice to try using INT_MIN as the invalid value that marks None. I've never actually used the extra negative value you get from twos-compliment, so giving it up in exchange for a smaller Option<T> seems like an excellent trade. Though, I wonder if that might have some complications for stuff like overflow checking.
I suppose you could always wrap NonZero with an accessor that adds 1 if negative to achieve the same result, though that might be too much overhead to be worth it.