"If anyone has good examples of macros that can't be expressed with a convenient notation for closures, it would be interesting to see them. My Smalltalk-hacking friend Trevor Blackwell has often claimed that macros were unnecessary if you had blocks." people.csail.mit.edu/gregs/ll1-discuss-archive-html/threads.html#02060
== HighlightsTrevor Blackwell's provocative post about places to avoid macros, and a summary of a lot of the examples in the thread: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02111.html
Its responses are good too. I would be careful using macros for them, but not avoid them entirely. See arc's obj and fallintothis's inittab (http://arclanguage.org/item?id=11187)"have all the examples of potentially non-blockable macros so far been cases
of punning, treating something as both code and data?" (define-syntax assert
(syntax-rules ()
((assert test)
(if (not test) (assert-error (quote test))))))
http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02101.htmlGuy Steele's symbolic-differentiation macro: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02088.html
Reference to how you would do that in smalltalk, but it tellingly doesn't have code: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02096.html
Three interesting-looking papers from 1984: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02106.html
Interesting back-story on common lisp's LOOP: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02107.html
A tantalizing reference to the language-vs-tool tension: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02134.html
Guy Steele (referring to the assert macro): "Macros let me express the idea that I need only a few relevant line numbers kept around at run time, rather than all of them."Trevor Blackwell: "I don't believe in adding a complex language feature for small runtime
savings." Meta-programming as code generation vs meta programming as parameterized higher-order functions: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02158.html
Avi Bryant dissing all before him: "Now, I know there are better examples out there, I just want somebody to bring them up. The best I can do right now is the typical with-html
macros people use for generating markup - I've never been able to
satisfactorily replace those in Smalltalk or Ruby." http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02122.html
Finally, Guy Steele echoing PG's opinion on brevity: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02162.html
http://www.paulgraham.com/popular.html
http://www.paulgraham.com/arcchallenge.html
Reading all this, my conclusion is that if you don't care as much about terseness (like Trevor Blackwell) you probably won't have as much use for macros.--- Parent thread that spawned this one: people.csail.mit.edu/gregs/ll1-discuss-archive-html/threads.html#02012
|