On Sun, Dec 28, 2008 at 6:14 PM, Yigal Chripun <[email protected]> wrote: > > could you please elaborate on this, and/or provide a code example?
Don's Blade library is more or less a proof of concept for what I would imagine to be possible with macros: http://www.dsource.org/projects/mathextra/browser/trunk/blade His library works by having you write your code in a DSL in strings, which you pass to the library and then mix in the resulting X86. http://www.dsource.org/projects/mathextra/browser/trunk/blade/BladeDemo.d If we had AST macros, the parsing would be performed by the compiler instead of hackishly using CTFE and templates, and the library would just be concerned with matching certain patterns of expressions, performing transforms on them (simplifications, optimizations, etc.), and turning them into D code. String mixins are incredibly powerful. But they're powerful in the way that assembly language is powerful - you can do anything, but there are virtually no useful abstractions provided, so you end up having to do everything yourself - parsing, pattern matching, etc.
