dpiponi: > 2009/10/7 Joe Fredette <jfred...@gmail.com>: > > Let me add to this, as I've used the term "DSL" without (*gasp*) fully > > understanding it before. > > > > In addition to "What is a DSL", I'd like to ask: > > > > "How is a DSL different from an API?" > > I don't think there is a sharp divide here. A nice example was given > by Pat Hanrahan at the recent nvidia GPU conference. He proposed the > idea that OpenGL was a DSL. His reasoning was that he could give a > formal grammar that accurately captured the structure of many > fragments of code making calls to OpenGL. For example you have blocks > of code bracketed by glBegin() and glEnd() with sequences of > primitives in between. In fact, some people indent their code to > reflect this structure as if glBegin() and glEnd() were control > structures within the host language. > > I've argued that every monad gives a DSL. They all have the same > syntax - do-notation, but each choice of monad gives quite different > semantics for this notation. For example the list monad gives a DSL > for non-determinism.
I've informally argued that a true DSL -- separate from a good API -- should have semantic characteristics of a language: binding forms, control structures, abstraction, composition. Some have type systems. Basic DSLs may only have a few charateristics of languages though -- a (partial) grammar. That's closer to a well-defined API in my books. -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe