How in the world to C people cope with the lack of generics or higher-order anything.

"There's 5 types, and they go from one type to another type. That's 5 x 5 combinations with no repetitions, guess I'm just gonna add that. Then there's 3 error handlers, so you need to do 5 x 5 x 3. And then there's a few sub-genres, so that's 3 x 3 x 3 to add on,"

Maybe this is why all the C interfaces are untyped and unsafe. Doing it any other way is basically like loading up a combinatoric shotgun and flipping it around to point at your own chest.

@thephd

Three points:

0. a bunch of #define TYPE's that go with a discriminant union

1. a completely MACRO based single- or double- linked list that is used to chain all instances of the types

2. a bunch of functions that work on the pointer to the type (aggregate type usually) mutating it from one state to another.

all of this physically placed in a "single translation unit" with typedef'd pointers and 'static' storage class liberally used to control visibility.

easy to reason and works.

@saifi @thephd
"Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of CommonLisp."

@Sdowney @thephd

+1

David Drysdale and Chris Kohlepp discuss the same perspective such as you mention at length.

what i highlighted is how it is typically done (in plenty of C and also C++ code) in code that we still need to maintain.

many abstractions in C++ when two-levels deep become difficult to reason.

@Sdowney Btw, thanks for the useful github summaries that you publish for every version of C++.