Wed Oct 29 10:14:30 CET 2008
High level programming in C: Data Structures
[ This should go in a separate CS.txt log. ]
What I miss most in C are closures and directed acyclic datatypes.
This made me think a bit about different classes of data structures in
a C program. In a dynamic language with GC these all tend to blend.
1. Linear types (pure trees): every object has a single reference,
which could be implemented as embedded structs (C struct
inheritance) or embedded struct pointers (C struct delegation).
2. Directed acyclic graphs: objects can have multiple references, but
there are no loops. Reference counting works here.
3. General graphs: If there are circular references, reference counts
won't work: you need to build "intelligent" constructors /
destructors for the whole graph.