Hacker News new | ask | show | jobs
by dtolpin 2758 days ago
"Embedded DSL" vs "Separate" is a matter of use of words. Anglican is macro-compiled inside Clojure into Clojure. If you like to call it a DSL, call it a DSL.

An important design feature is that it is 'anti-DSL' --- the syntax is exactly the Clojure syntax. But the program is transformed into an extended CPS form and run through inference executor. There is an academic paper written by Anglican team explaining the design and internals:

http://www.cs.ox.ac.uk/people/hongseok.yang/paper/ifl16.pdf

1 comments

My mistake, I misread the docs. Anglican can actually be considered to be an embedded DSL.

> An important design feature is that it is 'anti-DSL' --- the syntax is exactly the Clojure syntax.

This is not "anti-DSL", this is what gives Anglican embedded DSL qualities.

And yet there are limitations: «The border between Clojure and Anglican is subtle and usually will pose no problem to most programmers, however, some confusion can arise from the fact that Anglican programs are macro compiled into CPS-style Clojure functions. This means that some wrapping of “native” Clojure functions needs to happen in order to use them in Anglican. Errors arising due to misunderstanding this boundary crop up in the form of “wrong number of argument” exceptions».

Would that language border, wrapping of functions and transformation to CPS be still necessary in a language with native support for continuations?

Anglican is a CPS state monad. Clojure functions are automatically lifted into the monad, but to maintain fast execution of Anglican code, Clojure functions must be declared as such to Anglican.

A language with native support of continuations is a nice toy but does not bring practical benefits to implementing CPS state monad.