News for hackers. Stuff that matters.
Re:Pointer Free Programming and the Future of Nim by jjnoakes on Friday October 20, 2017 @11:13AM (#15516408)
So put a ref or a box in your optional.
Re:Pointer Free Programming and the Future of Nim by dbaupp on Friday October 20, 2017 @12:01PM (#15516808)
I don't think adding indirection is what the parent was thinking of. It's more like storing the Option<T> Some vs. None bit in its own separate bitvector along with a packed vector of Ts. This layout, due to padding, may be significantly less memory than alternating bool, T like a vector of Option<T>s gives, but it still retains properties like contiguous layout and minimal allocation/indirection.