Learn · Hidden Machines · Part VIII
budding
The Smell Is Evidence
Advisory structure recognition and a complete recovery.
You will turn one recovery into an advisory detector, separate broad and narrow phases, and evaluate precision against confirmed, tempting, and ordinary code.
From one tangle to a signal
Mutually exclusive booleans guarded by repeated conditions suggest a sum type or machine. Increasing identifiers compared after await suggest a generation fence. Allocation sites sharing one lexical lifetime suggest a region. None of these patterns proves intent.
Use a cheap broad phase to find candidates and a narrow phase to reject common false positives. Report the observed evidence, candidate structure, confidence limits, and next inspection—not a verdict. A corpus needs confirmed examples, tempting false positives, and ordinary code that should produce no finding.
Run the complete recovery on an autocomplete controller: flags reveal alternatives; callbacks reveal a machine; generations define publication authority; abort handles belong to the request scope; effect requests move to an interpreter; trace tests preserve visible results. The detector can point to the shared flags and post-await comparison. Only review can decide whether the local code is worth refactoring.
Measure precision and usefulness before rule count. A noisy detector teaches teams to ignore the rare valuable finding. Keep recognition advisory until intent becomes a mechanically checkable local contract.
Where the model stops
Static syntax cannot see every owner, external guarantee, or pending deletion. Do not infer certainty from a suggestive name. Do not train on only confirmed examples. A recommendation that cannot show its evidence is a style opinion in machine clothing.
Lessons
- Recurring syntax is evidence, not proof of architecture.
- Broad-phase candidates need conservative rejection.
- Findings should expose evidence and uncertainty.
- Precision and usefulness matter more than rule count.
Practice
- Write a signal and false positive for generation fences.
- Design a narrow rejection for genuinely independent booleans.
- Transfer the recognizer to protocol guards or mixed coordinate frames.
One question remains: what if recognition is correct and refactoring is still the wrong decision?
References
- “Patrick and Radhia Cousot, “Abstract Interpretation”.” — sound approximation as a foundation for static analysis.
- “Clang-Tidy documentation, “Contributing New Checks”.” — production guidance for diagnostics, false positives, and check scope.