Well "let" is certainly lisp and that's where Perl got the concept of lexical variables from.
The backquote in lisp is used in macro expansions if you want only some parts of the code to be expanded.(preceded by comma not dollar)
That's similar to.variable.interpolation but different because the result is code (a lisp list to be precise which is anything) and not a string like in Perl.
And I've never seen this construct outside of macros. (does it even work?)
So yes this part is Perlish, but not particular, its also Bashish or even Shish (= omni shellish)
I'd say back tick was taken to avoid backward incompatibilities with.double quotes as delimiter.
| [reply] |
but different because the result is code (a lisp list to be precise which is anything) and not a string like in Perl. And I've never seen this construct outside of macros. (does it even work?)
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
| [reply] |