One of the most powerful uses of Clojure's macro system has been in the core.async library. This has enabled the construction of a library with operators similar to Go's Communicating Sequential Processes [Hoare 1978].<p>What is different about Clojure's implementation is that no changes to the compiler were required - 'deep walking macros' (<a href="http://blog.fogus.me/2013/07/17/an-introduction-to-deep-code-walking-macros-with-clojure/" rel="nofollow">http://blog.fogus.me/2013/07/17/an-introduction-to-deep-code...</a>) were used - that actually restructure the code.<p>The benefit of this in the library is that when a process is blocked, the wait is converted to data and the thread is freed up and returned to the pool. You can have multiple processes talking to each other with a thread-pool size of one. (And still reason about the code in a neat way).<p>The benefit of this comes in the JavaScript environment, (via ClojureScript) where you can compile code that you would ordinarily coordinate with threads using CSP. (With Go-lang style operators)<p>You can see an example of this on David Nolen's pages here:
* 10,000 processes <a href="http://swannodette.github.io/2013/08/02/100000-processes/" rel="nofollow">http://swannodette.github.io/2013/08/02/100000-processes/</a>
* 100,000 updates
<a href="http://swannodette.github.io/2013/08/02/100000-dom-updates/" rel="nofollow">http://swannodette.github.io/2013/08/02/100000-dom-updates/</a><p>This is the power of macros in Clojure - things that would require a compiler extension in another language, are a library in Clojure.
These articles tend to miss a new development in JavaScript: sweet.js (<a href="http://sweetjs.org/" rel="nofollow">http://sweetjs.org/</a>), hygienic macros for JavaScript. It is essentially scheme's syntax-case/rules completely for JS, and it's done <i>really</i> well.
Code-walking macros are very powerful, but there's a performance caveat:<p><a href="https://code.google.com/p/chibi-scheme/issues/detail?id=114#c3" rel="nofollow">https://code.google.com/p/chibi-scheme/issues/detail?id=114#...</a><p>For most macros, this won't be an issue. But if you wind up with code-walking macros than can be nested, you need to be mindful of the nesting or your code might take a while to compile.