Checkpoint: The Generic Layer Cake
intermediate26 min readLesson 120 of 148
Prove the whole stack: byte engine, stdlib wiring, and a typed facade — one API, three layers.
The task
Implement g_sort and g_dedup (see the challenge). The facade macro
isort is given — your engine beneath it must be correct for ANY
element type, and dedup must enforce its own precondition (sort
internally). This is the module's thesis in two functions: the
byte-level engine does the work, the type system lives in the callers.
Passing this proves you can write the layer C libraries actually ship: generic at the bottom, type-safe at the top, contracts in between.
Next module: the preprocessor — macros as a language over the language.