OK interesting, Julia metaprogramming looks very similar to this, and I hope to take inspiration from it for oil:
http://docs.julialang.org/en/stable/manual/metaprogramming/
https://en.wikibooks.org/wiki/Introducing_Julia/Metaprogramm...
They use :(expr) or quote/end for quotation, and $var for interpolation. Elixir metaprogramming uses quote/end for quotation, and unquote for interpolation. (In fact the entire Elixir language appears to be done with AST metaprogramming, since it's on top of Erlang.)
I basically think of these schemes as "Lisp-like AST metaprogramming, but with Syntax". Thanks for the pointer on Scala.
I saw a video where people asked why Clang source tools generate textual changes rather than AST changes... and this is a good example. People for some reason think that ASTs are "cleaner" or more usable, but they can be a pain.
e.g. For code snippet "class C(x: Int)" Scala compiler create a tree that roughly resembles the following code:
This tree looks even more terryfing under the hood in terms of AST constructors. Instead of making people figure out how that works we support nice high level sugar instead: Where q is a magic string interpolator that is compiled to generate an equivalent AST. It can be used for both construction of new AST nodes based on the older ones (we use $name syntax to substitute thing in) and also deconstuction of existing ones into smaller pieces via pattern matching ($name extracts parts out.)[1] http://docs.scala-lang.org/overviews/quasiquotes/intro.html