Executable Contracts for Elixir
summary
A small Elixir library implements executable contracts by macro-transforming code and runs pre/post checks, exception specifications and timers; it catches the list-of-digits mistake and flags a factorial infinite-recursion via a timeout check, enforces decreasing measures for recursion (avoiding n → n-1 bugs) and documents a one-annotation-per-function limitation. Runtime cost grows with heavy predicates (checking a list of digits scales with input size). Repository is public, aimed at simplicity for courses and incremental adoption with preconditions and postconditions.
AI-written summary · about
chapters (10)
- 0:00Start
- 1:40Motivations
- 14:08Functional Specification
- 15:30Exceptions
- 20:13Time Limits
- 21:26Warnings about the Use of Time Limit Contracts
- 30:51Comments about the Implementation
- 31:21Limitations
- 38:20Purity Contracts
- 38:52Invariance
related talks
52mWrite Less, Do More (and Have Fun!) with Elixir Macros
20mError-free Elixir
56mKeynote: Think Different
32mElixir for the rubyist
42mIt's about (run)time -- Elixir beyond the hype
58mHow I learned to stop worrying and love macros
37mMetaprogramming + DSL Design in Elixir
37mElixir - functional, concurrent, distributed programming
