3 ms·
I think maybe the argument should be that C 'makes explicit' certain fundamental concepts - pointers and pointer dereferencing, explicitly choosing between allo
by austinz 12y ago
I think maybe the argument should be that C 'makes explicit' certain fundamental concepts - pointers and pointer dereferencing, explicitly choosing between allocating memory on the stack versus the heap, the idea that things like arrays, strings, objects, trees, etc can be built out of very basic abstractions. These are concepts that are important to know in order to really have a good idea of what is going on when you program in a higher-level language, even if you never actually do work that requires C's error-prone string handling or manual pointer manipulation.
I don't know if C is necessarily the best language to familiarize users with these concepts. Rust makes users grapple with the implications of explicit memory management but does so in a way that is far less dangerous at runtime than C (at least in many cases). So maybe figuring out how to reason about pointers and lifecycles and ownership in an explicit way in order to get a Rust program to compile is better than messing around with code that segfaults and does weird things until it happens to start working properly.
But I still think there is some value to hands-on experimentation. Concepts like "primitives are passed by value, but objects are passed by reference" in a higher-level language might seem like arcane trivia to a beginning programmer, but someone who has played around with the same idea in C (or another language where this sort of thing is reified) might be better positioned to understand the underlying rationale.