
A Declarative Language for the BEAM: Alejandro Ramallo on Bondy
Notas del episodio
Alejandro Ramallo spent months losing sleep over NIF memory leaks that only appeared under high load and were almost impossible to reproduce. The fix in the latest Bondy Connect release: remove every NIF, go pure Erlang, and replace the storage layer with an operation-based CRDT database running causal+ consistency.
A decade of running that distributed router in production, and maintaining Partisan underneath it, is the background to Bondy, the declarative language Alejandro introduced at Code BEAM a week before this recording. It targets a specific pain: business rules spread across gen_statem states and clauses until nobody can say where a rule lives.
Bondy is statically typed, compiles to ordinary BEAM files and calls Erlang and Elixir directly. It combines Datalog for queries with Constraint Handling Rules for reacting to events and writing solvers. At Leapsight, rules that took around 800 lines of Erlang come down to 40–50 lines of Bondy, and a fluid-delivery scheduling solver for upstream oil and gas took one week instead of three months.
Using a fleet of refrigerated trucks as the running example, Allen and Francesco work through what runs today, what is designed but not built, and what is on the roadmap.
• NIF memory leaks and control-plane conflict-resolution bugs in Bondy Connect, and how both were removed
• Why a library wasn't enough: rules, data and types sharing one language
• Shapes: one definition that is both type and runtime validator, including cross-field invariants
• Unification for sensor data that arrives in pieces
• Structured, path-based errors written for humans and coding agents
• The effect system: capabilities, pure guards and synthesis holes
• gen_reactor, a new OTP behaviour that runs rules to a fixed point under normal supervision
• How CHR semantics, propagation history and termination/confluence analysers keep rules from fighting or looping
• Signals, fluents and logical time for latching alarms and queryable history (designed, not yet implemented)
• Datalog relations for escalation chains that terminate even when the hierarchy loops
• Semi-naive evaluation today; magic sets, cost-based optimisation and incremental view maintenance on the roadmap
• Well OS, CHR-based solvers, and where coding agents help or break architecture
Recorded October 30, 2026.
Resources:
Bondy language: https://www.bondy.io/language
Partisan, Constraint Handling Rules (Thom Frühwirth, 1991), and the upcoming Bondy public release are discussed in the episode.