4 ms·
True, though in OP's defense I don't know if I've ever seen a language refer to a growing list of entries as an "array".
by cnity 4y ago
True, though in OP's defense I don't know if I've ever seen a language refer to a growing list of entries as an "array".
- linkdd 4y agoWell, the data structure is called a dynamic array
- cnity 4y agoI don't see any reference to it in the GH readme, but I do wonder what they call actual arrays (as in, fixed size allocations of memory that store a contiguously typed value).
- linkdd 4y agoI was talking about std::vector (and Rust's Vec). Those are dynamic arrays (as in, growable allocations of memory that store a contiguously typed value).
- yakubin 4y agoJava: ArrayList Zig: ArrayList GLib: GArray Objective-C: NSMutableArray
- domenukk 4y agoFWIW, ArrayList is a List, backed by Arrays. So List would have been the more Java/Zig way to name it (also Python, etc.)
- yakubin 4y ago> FWIW, ArrayList is a List, backed by Arrays. You probably know that, but just to clarify: it's backed by a single array, reallocated repeatedly, just like std::vector in C++ (although growth factors are different, I think). Just "List" probably risks that some people will jump to the conclusion that it's a linked list. I'd probably prefer the full "ArrayList". Although personally I'd use something like "DynArray"/"DynamicArray".
- cnity 4y agoThese are examples in favor of my point, not against it.
- jsnell 4y agoDoesn't seem particularly uncommon. Perl, JavaScript, and Ruby come to mind if you're really looking for languages that use just a raw term "array" with no extra qualifiers.
- slt2021 4y agoObject Pascal's arrays are dynamic. var kek: array of int; setlength(kek, 666); // kek is now int[666] setlength(kek, 1337); // kek is now int[1337]