The compiler is your best friend

Assertions, “This Cannot Happen,” and Crashing

  • Many comments debate the pattern of branches labeled “this CANNOT happen” plus an exception or assert.
  • Some see such comments as useless or dangerous “rot” unless backed by tooling or proofs; others say they at least document assumptions.
  • Consensus: a runtime assertion or panic is better than a bare comment; ideally with a message explaining why the programmer thinks it’s unreachable.
  • There’s disagreement on whether unreachable branches are laziness or due diligence; some argue it’s responsible to have a defensive path that loudly fails.

Result Types, Exceptions, and Error Propagation

  • The article’s suggestion to replace exceptions with result types prompts discussion.
  • Advocates like explicit Result/Option-style APIs and explicit propagation (foo()?) over hidden throws.
  • Critics note that some internal logic errors have no meaningful recovery path; eventually something must panic/crash or show an “internal error, please restart” dialog.
  • Several argue that for violated invariants, “crash loudly” is preferable to silently continuing in corrupt state.

Types, “Lying to the Compiler,” and Noun-Based Design

  • Many tie “lying to the compiler” to weak typing, unchecked casts, nulls, and non-exhaustive modeling of state.
  • Strong type systems (Rust, Swift, TypeScript with strict null checks, ML/Haskell) are praised for making invalid states unrepresentable and surfacing invariants at compile time.
  • Others push back on “noun-based programming” and heavy type modeling as dogmatic and complex, especially for messy business rules that don’t map cleanly into types.

Functional Core / Imperative Shell and Testing

  • The “functional core, imperative shell” pattern gets a lot of practical discussion.
  • Suggestions include: ETL-style fetch/compute/store; representing effects as data; using hexagonal architecture; or even pure SQL views as the “core.”
  • Acknowledgment that clean separation is sometimes hard; monads, free monads, or polymorphic abstractions are proposed when side effects and logic are tightly interwoven.
  • Several point to resources (books, blog posts) and emphasize that separation is about easier reasoning and debugging, not just testability.

Reliability, Bit Flips, and Complexity

  • Bit flips (cosmic rays) are mentioned as ultimate edge cases; most agree typical software just crashes/restarts rather than defending against them.
  • There’s concern about growing complexity and bloat in compilers and build stacks (LLVM, Rust dependencies, large GCC trees), and the maintenance burden this creates.