January 5, 2020

Transparency through data


James Reeves, the weavejester. Author of many clojure libraries


I am getting the sense of how to write DSLs still. I think this is very handy and very elegant solutions can be born out of that.

I need to practice it.


code is data, code is already transparent, right?

transparency is about understanding and understanding is about prediction

code that’s easy to predict is easy to understand

with great power comes grest unpredictability

Computer Science in the 1960s and 80s spent a lot of effort making languages that were as powerful as possible. Nowadays we have to appreciate the reasons for picking not the most powerful solution but the least powerful. Tim Berners-Lee.

DSL accumulates over time

if it cannot repeat, it’s not turing complete.

Code snippets

(context "/user/:uid" [uid]
 (GET "/posts/search" [q]
  (search-user-posts uid q)))


  1. domain specific languages is one way to get these specific less powerful solutions

  2. avoid loops and recursion in DSLs

  3. look for matching and destructuring in DSLs

  4. look for static structure in DSLs

  5. make use of :namespaces/keywords

  6. make use of different data types

  7. make use of spec for complex grammars

Tags: clojure