Re:How Lisp macros differ from static code-generation and me...
by nkurz on Saturday January 29, 2011 @05:32PM
(#2156624)
Do you have a link for the "painted blue" reference? I agree with your explanation, but had never heard that particular phrasing and was intrigued by it. But searching on Google for things like 'expand ansi macro "painted blue"' returns only your comment and a scraped spam site of someone answering a similar question.
Re:How Lisp macros differ from static code-generation and me...
by dexen on Monday January 31, 2011 @02:49AM
(#2160674)
Indeed surprisingly hard to find a first hand reference.
But http://duckduckgo.com/?q=%22painted+blue%22+expansion
returned link to wikipedia article, which, in turn, links to some meta-document about new C standard. There's also some post on Boost (library) mailing list:
http://duckduckgo.com/?q=macro+%22painted+blue%22+boost
->
http://lists.boost.org/Archives/boost/2006/01/99264.php
Perhaps I was wrong; perhaps the phrase was in K&R C? Can't find the book online @_@;;
(a nonsensical example, as I can't think of a proper one right now)
#define PRINTFOO PRINTBAR
#define PRINTBAR PRINTFOO
PRINTFOO
The ANSI C standard says a macro, while it is being expanded by the preprocessor, ``is painted blue'' (is no subject to further expansion).
I'm not sure, but probably it follows the C macros are not Turing-complete.
EDIT: on the other hand, a LISP macro system is a Turing-complete programming language that's geared towards manipulating lists of symbols and values (which, incidentally, is LISP program).