3 ms·
Data structures are not the same thing as types. Data structures are bit patterns and references to other bit patterns (pointers or relationships). Types (as
by alphazard 2y ago
Data structures are not the same thing as types. Data structures are bit patterns and references to other bit patterns (pointers or relationships). Types (as they are used in programming languages) place some constraints on those bit patterns, but can also encode many other language features.
Creating an elaborate type hierarchy with unnecessary abstractions is not what is meant by "worrying about data structures", and that tendency is one of the most common failure modes for otherwise smart engineers.
- phkahler 2y agoTypes are data structures that the language is aware of. This allows the tooling to do checks that they can't do on plain old data structures.
- Arelius 2y agoI think this is a subtle and important point. Types are a potential useful tool to restrain and and specify the schema of data structures. But concern for types is very different then concern for the data structures.
- atomicnature 2y agoGood catch. Equating data structures to types is an over simplification that misses the core point. I think the original call here is to simply think harder about the problem and avoid picking structures that'll burn you later. For example, take Unix pipes, see how far they've traveled, how many domains, how many use cases. It's a brilliant way to visualize system building while respecting the constraints of minds and machines. And it took Ken and others quite a while to realize something like pipes could make sense in Unix. It was not an insight easily obtained but required a bit of hustle and followup and obsession with finding the right building blocks for a system.
- jvanderbot 2y agoData structures are algorithms at rest. They shuffle and move things each operation, but mostly sit still, like a turing machine that people only crank once in a while. Types are the bits on disc.
- EVa5I7bHFq9mnYK 2y agoThe same data structure can be assigned different types, that's what typedef operator in Pascal does.