3 ms·
Gotcha, ta. That becomes a tricky problem when we're talking about something that's primarily a storage engine though, right?
by thom 5y ago
Gotcha, ta. That becomes a tricky problem when we're talking about something that's primarily a storage engine though, right?
- valenterry 5y agoNot sure - because in the end, a programming language also has to store this concept in memory. I don't think there is a fundamental difference.
- paavohtl 5y agoWell, sum types are not magic - they must be stored in the memory somehow. Rust's enums tend to use a simple approach: there's a large enough integer tag (usually an 8-bit integer), followed by enough space to store any of the variants. The same exact encoding could be used with a database storage engine too.