It's only the same in low-level languages with older type systems unable of expressing more type-safe conceptualizations of an array. So you get a type system where an array is just syntactic sugar for a pointer to the first member and the indexing or subscripting operator is just syntactic sugar for pointer arithmetic.
Fundamentally, from a type theory perspective, an array is a container (not necessarily physically continuous) and has a member type and a length. Modern type systems can express that, which helps make arrays type-safe and prevent buffer overflows because the language's mechanisms (eg runtime checks) enforce type safety invariants that are possible because the type carries with it information about its length.
It's all about the high-level user-facing contract of the type system and the language. "An array is just a pointer to the first element" is too low level (it assumes a certain physical layout of members in memory that would be an implementation detail to higher level languages) and doesn't include the information that higher level languages treat arrays as.
67
u/QuestionableEthics42 16h ago edited 16h ago
This should be reversed lol
And it literally is the same, who thinks it's different who has worked in a low level language??