Cluster & Brickmione
Hey, I’ve been sketching a city’s street network as a weighted graph and wondering if a custom DSL would let us compress the data and avoid bugs. Do you think a pure functional language would help keep the state clean, or would the overhead outweigh the benefits?
If you really need to cut bugs, a DSL that encodes the graph rules can work, but you’ll need a solid type system. A pure functional language will keep state immutably, so you won’t end up with hidden mutation bugs, but every new node or edge will create a new structure unless you use persistent data structures. In practice Haskell or OCaml give you the safety you want with reasonable runtime, but if you’re running in a tight loop you’ll pay for copying. I usually build the core in a fast imperative language and expose a small functional API to keep the surface clean. And remember: a DSL is only as good as the parser you write for it.