Skip to main content

Timeline for Multidimensional vs nested arrays

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Aug 4, 2022 at 9:00 history tweeted twitter.com/StackSoftEng/status/1555116346786078720
Jul 30, 2022 at 22:15 review Close votes
Aug 4, 2022 at 3:10
Jul 30, 2022 at 21:35 vote accept Steve
Jul 30, 2022 at 21:30 comment added Andris Birkmanis Some operations, like transpose, are only defined on regular arrays, so the difference is not limited to optimizations.
Jul 30, 2022 at 20:23 history became hot network question
Jul 30, 2022 at 20:15 answer added Christophe timeline score: 4
Jul 30, 2022 at 14:43 comment added Ben Cottrell They are fundamentally different; including memory representations ('array-of-pointers' vs. a single cohesive block), with different constraints, guarantees, and available operations; which affects how programmers write their code, Even in cases where the same functionality can be implemented in either, the choice would determine whether the code is idiomatic, or whether it involves unnecessary and avoidable complexity, which is likely to be detrimental in areas like code quality, legibility, automated testing and maintainability, compared with choosing the most appropriate abstraction.
Jul 30, 2022 at 13:48 comment added Steve @BenCottrell, but they don't appear to me to be two different abstractions. They appear to cover exactly the same ground, save that the nested way is entirely more general because it can cope with irregular as well as regular arrays (with no apparent hardship in terms of syntax). As for native arrays, the byte is an array of bits, and main memory is an array of bytes. Registers and instructions typically operate on words.
Jul 30, 2022 at 13:04 comment added Ben Cottrell My point is that you can ask of any high-level language feature whether it's necessary, and the answer is nearly always "no" because all anyone really needs are whichever instructions are available natively to the platform, and then you'll always have a way of being able to implement higher-level abstractions on top of that, whether those abstractions are data types, language keywords, libraries or anything else (Arrays are a higher-level abstraction based on simple arithmetic with memory addressing, not a native feature of any CPU instruction set that I've ever heard of)
Jul 30, 2022 at 12:34 comment added Steve @BenCottrell, well obviously I'm not asking "could we just do it all in assembly instead". I'm asking is there anything you can do with multidimensional arrays which you can't trivially do with nested. Also, all computers have to have some arrays natively - at least as I understand it.
Jul 30, 2022 at 11:57 answer added candied_orange timeline score: 2
Jul 30, 2022 at 11:34 comment added Ben Cottrell No, the same is also true of 99% of all programming language features - there's absolutely nothing that anyone can do with any feature of any high-level language which couldn't also be done without them. Anything you can do with multi-dimensional arrays or nested arrays can also be done using raw machine code which has no such concept as an "array" let alone the concept of a "dimension". For example, there's also no need for functions, classes, for/while loops, if/else, switch, data types, etc.
Jul 30, 2022 at 11:12 history asked Steve CC BY-SA 4.0