3 ms·
I think you're conflating different things. This is about how to represent a null values in memory (for a columnar data structure), not how null values are exp
by jmull 3y ago
I think you're conflating different things.
This is about how to represent a null values in memory (for a columnar data structure), not how null values are expressed and accessed in a particular language's type system. However null values are represented in memory, you'd want an appropriate language binding/reppresentation.
- deathanatos 3y agoYes, but only from a strictly theoretical view. One influences the other, and in particular, one makes the other much more difficult. Representing "INT32_MIN is None" in, e.g., Rust, is possible, but it's much more troublesome. I'd need something like Option<ASpecialI32>, where that inner type excludes the sentinel. Cf. representing "all i32s are valid, plus there's a None value", that's just Option<i32>. And in practice, if someone has an odd sentinel value like that in the data format, library authors tend to be lazy and not take the time to do that wrapping; instead, they just expose the i32 directly, maybe Option<i32>, and sharp edges abound around the sentinel. (That is, the data format — a sentient value — encourages buggy code. And that is the billion dollar mistake: that a nullptr pretends to be a pointer, while it is not, and gets swept up in the same operations.)
- Dylan16807 3y agoWhat's the memory representation of an Option<> then? Do you want to add 4 bytes to each value to hold the tag? Even if you do that, a lazy author might still provide raw access to the ints.