I\'m reading Let Over Lambda, which deals with some pretty deeply layered macro authoring. It\'s fascinating and I\'m mostly managing to keep up with it.
In Chapter 4 Ho
During evaluation of a doubly backquoted form, the inner backquote is handled first, and the result is a singly backquoted form. During evaluation of the inner backquoted form, only elements preceeded by two commas are evaluated. However, the result of evaluating these doubly unquoted elements are still (singly) unquoted, and are thus evaluated again when the resulting singly backquoted form are evaluated. To achieve evaluation only in the inner backquoted form, an ordinary quote has to be inserted, resulting in ,',
.
See how
(let ((tmp (gensym)))
``(lambda (,tmp ,,tmp ,',tmp) ()))
evaluates to
`(LAMBDA (,TMP ,#:G42 #:G42) nil)
The ,',X trick is used to shield the X from another evaluation.
See how:
(setq a 'fn)
(let ((x 'a)) ``(,,x ,',x)) ==> `(,a a) ==> (fn a)
;; ``,',X ==> `,(quote "the value of X") ==> "the value of X"
;; ``,,X ==> `,"the value of X" ==> "the value of the value of X"