3 ms·
I believe that they mean you can’t mess it up; a slice is much nicer than two separate things. There’s no way to get them out of sync, etc.
by steveklabnik 7y ago
I believe that they mean you can’t mess it up; a slice is much nicer than two separate things. There’s no way to get them out of sync, etc.
- jstimpfle 7y agoI was pointing out vector objects (as opposed to rawpointers) mainly because I'm not aware of any other practical way to enable automated bounds checking. Apart from that I actually find it more appealing and "correct" to have a separate length value. As soon as there are multiple parallel arrays the vector approach will have redundant length information, so from an aesthetical point from of view I prefer not to glue the length to the vector/array. But yeah, with a separate length there is more manual work for simple tasks, so it's easier to mess up.