2 ms·
It was arbitrary in that they chose to use a leaky abstraction to make it easier for themselves to make arrays using their memory model. The first person to do
by ok_dad 4y ago
It was arbitrary in that they chose to use a leaky abstraction to make it easier for themselves to make arrays using their memory model. The first person to do this could also have subtracted one from the user’s index to get the memory offset.
- nocman 4y agoThat's not what arbitrary means. Arbitrary means there was no logical reason behind the choice, they just picked one. You can dislike the reason all you want. You can disagree with their choice, or think there are more important reasons to choose what you think they should have chosen, but that doesn't make their choice arbitrary.
- jabbawookiees 4y agoOr they could have saved themselves a CPU cycle every time they needed to index an array. Don't get me wrong, non-zero-cost abstractions are great when they improve developer ergonomics commensurate to how much they cost. Garbage collection at the expense of GC overhead? Yes please. Classes and methods and inheritance at the expense of vtable lookups? Sure! One-indexed arrays at the expense of either giving up the memory of the first item or always subtracting every index operation? Eh... I think I'd rather count from zero.