3 ms·
> The only place where I couldn't find a zero cost abstraction was enum encoding, where enums are of different sizes. Unfortunately, variable-sized types inter
by Twisol 6y ago
> The only place where I couldn't find a zero cost abstraction was enum encoding, where enums are of different sizes.
Unfortunately, variable-sized types interact poorly with arrays -- you can no longer access any element in constant time. UTF-8 has essentially the same issue.
Did you end up abstracting over the byte array at all? I would imagine that some kind of `BytecodeBuffer` could give pretty reasonable ergonomics over a raw buffer without sacrificing efficiency or correctness.
- masklinn 6y ago> Unfortunately, variable-sized types interact poorly with arrays Unsized types interact badly with everything, really. That's why you usually shove them behind a pointer.