Proposal: Essential Effects for C
This proposal suggests enhancing C's core type system with a type-and-effect system, requiring functions and blocks to declare the effects of their evaluation. This improves metaprogramming composability and simplifies defining MISRA-style restrictions. The system tracks and checks effects but doesn't handle dynamic effect handling. Three main effect groups are proposed: Local (e.g., local writes), Persistent (e.g., non-local writes), and Control (e.g., non-local control transfers). Static effect checking is achieved by assigning type-and-effect to each statement, expression, and function body, discarding local effects to ensure correct ordering. Best practices are suggested, like limiting the magnitude of `mut` and `vol` effects and specifying effect checks for operators and control structures. The goal is to improve C's safety, readability, and composability, especially for metaprogramming and resource management.