My Kind of REPL
11 days ago
- #programming
- #workflow
- #testing
- The author advocates for a programming workflow where programs can modify their own source code, creating a 'read-eval-patch loop' that integrates REPL-like functionality directly into the development process.
- This approach allows developers to write tests by running expressions in their code editor, with results automatically inserted into the source file, serving as persistent test cases.
- The workflow emphasizes the immediate utility of tests, making them part of the development process rather than a separate, future-oriented task.
- Good tests are described as observations of a program's behavior, with visualization and printf debugging integrated directly into the testing framework.
- The technique is language-agnostic, with examples provided in Janet, OCaml, Rust, and even JavaScript, demonstrating its broad applicability.
- The author highlights the benefits of this approach, including easier test creation, immediate feedback, and tests that double as documentation.
- Tools like Cram are mentioned as a way to implement this workflow in any language, even without native support.