News for hackers. Stuff that matters.
Re:Why Lisp macros are cool, a Perl perspective (2005) by ICWiener on Thursday December 04, 2014 @04:07PM (#8701638)
The regex example is more about partial evaluation than constant inlining. So instead of commenting on "random one-liner snippets" and "structure", which I find boring, I'd prefer to share an example of partial evaluation techniques applied to Haskell:

http://repository.readscheme.org/ftp/papers/coutts_transfer_...

The whole essay is interesting. Then, at section 4, we discover that the author relies on Template Haskell:

Using the Template Haskell infrastructure confers a number of advantages. There are the straight-forward obvious advantages that TH provides an abstract syntax tree, a parser, pretty printer and a monad providing unique name supply and error reporting. Because it is part of a compiler, the compiler also does the other ordinary semantic checks including typechecking. This is obviously useful since our partial evaluator can only be expected to work for well formed and typed Haskell programs and so we are spared from performing these checks. A less obvious advantage is that we may be able to do binding time checking in terms of a slightly modified Haskell type system and implement it using the existing compiler’s type checker rather than having to write one from scratch.

There are no comments on this comment yet.