Use of Clojure macros for DSLs

前端 未结 4 2413
面向向阳花
面向向阳花 2021-02-20 06:14

I am working on a Clojure project and I often find myself writing Clojure macros for DSLs, but I was watching a Clojure video of how a company uses Clojure in their real work an

4条回答
  •  星月不相逢
    2021-02-20 06:53

    Here's an example of a DSL in Haskell that uses functions rather than macros:

    http://contracts.scheming.org/

    Here is a video of Simon Peyton Jones giving a talk about this implementation:

    http://ulf.wiger.net/weblog/2008/02/29/simon-peyton-jones-composing-contracts-an-adventure-in-financial-engineering/

    Leverage the characteristics of Clojure and FP before going down the path of implementing your own language. I think SK-logic's tips give you a good indication of what is needed to implement a full blown language. There are times when it's worth the effort, but those are rare.

提交回复
热议问题