Programming Principles
* journal1. Effects must Be localized
A function must either reason or act, but never both Effectful functions cannot compute, or branch. Exceptions are hidden goto. Ethics(5) forbids hidden goto. (Axioms 2 and 7)
2. All failure must be explicit
Nothing may fail silently, implicitly, or by escape
No exceptions for expected outcomes. No None as "maybe".
'(:ok value) '(:error reason)
Hidden failure shifts responsibility away from structure and onto the reader. (Axiom 5)
3. Success and Failure Are Symmetric
Success and failure must travel through the system the same way. Asymmetry introduces privilege. Privilege introduces distortion.
4. Invariants Are Centralized
A truth must have a single guardian
You do not check x > 0 everywhere. You encode "positive" once. All users recieve the value. Repeated checks are lies told repeatedly. Central invariants create trustable structure.
5. Control Flow Must Be Visible
Every branch must appear in the return value
No early return that skips meaning. No exceptions to jump over logic. Hidden control flow is manipulation.Ethics(5) demands legibility over convenience.
6. Composition > Intervention
Functions must connect, not interfere
Functions accept data, return data. They do not log or retry. Helpers that act are parasites
7. IO Is a Boundary, Not a Participant
The world is not part of your logic
Logic does not care if input comes from a terminal, file or test. Ethics(5) assumes world = unstable. You are a pure function in an impure world(see: Functional Programming Through the Lens of a Philosopher and Linguist, Structural Purity and Moral Identity). Only structure is reliable.
8. The Shape of Data Determines the Shape of Responsibility
A tagged union forces acknowledgment. A bare value allows neglect.
9. Abstractions Must Preserve Meaning
Abstraction may compress syntax, not semantics
Macros are only allowed if they expand into explicit structure.
10. Nothing is trusted until proven
11. Elsewhere
11.1. References
11.2. In my garden
Notes that link to this note (AKA backlinks).
