Null references, UI loading spinners that show errors and data simultaneously, payments that are captured and voided at the same time. These are not hypotheticals. They are the direct consequence of types that lie about the domain.
A traffic light that is red and green at the same time. A user who is logged in and logged out simultaneously. Boolean flags make these absurd states perfectly representable, and that is the problem.
Every enum you write is a formal grammar. Every sealed trait is a set of production rules. You have been doing formal methods all along; you just did not know the name. We trace the connection from Chomsky’s hierarchy to your domain types in Rust and Scala.
While revisiting the TaskRepository trait from the Todo CLI series, I realized I was doing more than drawing an architectural boundary. I was also defining what could be said across that boundary, which is much closer to grammar than I first admitted.