3 ms·
> To me it would be conceptually simpler to consider one named variable as analogous to a memory location. I don't think this will work well in practice. For e
by sdht0 6y ago
> To me it would be conceptually simpler to consider one named variable as analogous to a memory location.
I don't think this will work well in practice. For example, would you want to declare a new variable every time an array is reallocated at a new memory location?
Reusing variables has both ergonomic (don't have to think about and manage new names) and conceptual (x may represent the same "thing", e.g., a reallocated array) values.
And in this particular case, the compiler will very helpfully tell you what went wrong, so it's not like a programmer will have to hunt down the bug for hours trying to understand what happened. The programmer has to learn this once. Can we then call this a complexity issue then?
- deleted 6y ago[deleted]