in reply to Re^2: What's new in ECMAScript6, or: Oh no! Don't steal syntax from Perl!
in thread What's new in ECMAScript6, or: Oh no! Don't steal syntax from Perl!
It does, actually. Keep in mind lisp doesn't really distinguish between code and data (the interior of a lambda is a list like everything else (*)). You can use the backquote anywhere you can use a regular quote. And this does come up: sometimes the backquote is the easiest way to build a complex data structure.
(Conversely, you can use a regular quote in a macro if you have a template that's actually constant, i.e., if there are no holes, then it doesn't matter which you use -- except in that people will expect the backquote, be confused if they don't see it, and it generally doesn't cost extra -- macro-expansion happens at compile time anyway),
(*) unless you're trying to do hygenic macros, in which case you need extra structure, i.e., it's not enough to build a list to represent your code; there needs to be something extra that remembers the state of the lexical environment at the point where the list was built so that when the various lists later get getting shuffled around in the course of macro expansion any variables included within will always be the "right" ones
|
|---|