Macros 定义Lisp宏时是否使用双引号(双逗号)?

Macros 定义Lisp宏时是否使用双引号(双逗号)?,macros,lisp,Macros,Lisp,当定义使用macrolet的宏或定义定义宏的宏时,似乎使用了,',或,来取消引用。有没有过我需要使用,的情况?当然 以下是来自: 另一个例子来自clx/gcontext.lisp: (macrolet ((def-gc-internals (name &rest extras) (let ((macros nil) (indexes nil) (masks nil)

当定义使用macrolet的宏或定义定义宏的宏时,似乎使用了
,',
来取消引用。有没有过我需要使用
的情况?

当然

以下是来自:

另一个例子来自
clx/gcontext.lisp

(macrolet ((def-gc-internals (name &rest extras)
             (let ((macros nil)
                   (indexes nil)
                   (masks nil)
                   (index 0))
               (dolist (name *gcontext-components*)
                 (push `(defmacro ,(xintern 'gcontext-internal- name) (state)
                          `(svref ,state ,,index))
                       macros)
                 (setf (getf indexes name) index)
                 (push (ash 1 index) masks)
                 (incf index))
               (dolist (extra extras)
                 (push `(defmacro ,(xintern 'gcontext-internal- (first extra)) (state)
                          `(svref ,state ,,index))
                       macros)
                 ;; don't override already correct index entries
                 (unless (or (getf indexes (second extra)) (getf indexes (first extra)))
                   (setf (getf indexes (or (second extra) (first extra))) index))
                 (push (logior (ash 1 index)
                               (if (second extra)
                                   (ash 1 (position (second extra) *gcontext-components*))
                                   0))
                       masks)
                 (incf index))
               `(within-definition (def-gc-internals ,name)
                  ,@(nreverse macros)
                  (eval-when (:execute :compile-toplevel :load-toplevel)
                    (defparameter *gcontext-data-length* ,index)
                    (defparameter *gcontext-indexes* ',indexes)
                    (defparameter *gcontext-masks*
                      ',(coerce (nreverse masks) 'simple-vector)))))))
  (def-gc-internals ignore
    (:clip :clip-mask) (:dash :dashes) (:font-obj :font) (:timestamp)))

简而言之,这并不常见,但也并非闻所未闻。

@Robert the
=defun
示例似乎是为了将
(=defun hello(xy)(+xy))
扩展到
(progn(defmacro hello(xy)`(=hello*cont*,x,y))
,这是根据Lisp pdf上的继续部分。
、index
示例似乎与
、index
的作用相同,因为
index
包含一个自评估的数字。此外,您可以决定
(=defun hello(xy)(+xy))
应该扩展为
(progn(defmacro hello(&rest args)`(=hello*cont*,@args))…)
相反,它消除了使用
,@
,同时实现了相同的目标。
(macrolet ((def-gc-internals (name &rest extras)
             (let ((macros nil)
                   (indexes nil)
                   (masks nil)
                   (index 0))
               (dolist (name *gcontext-components*)
                 (push `(defmacro ,(xintern 'gcontext-internal- name) (state)
                          `(svref ,state ,,index))
                       macros)
                 (setf (getf indexes name) index)
                 (push (ash 1 index) masks)
                 (incf index))
               (dolist (extra extras)
                 (push `(defmacro ,(xintern 'gcontext-internal- (first extra)) (state)
                          `(svref ,state ,,index))
                       macros)
                 ;; don't override already correct index entries
                 (unless (or (getf indexes (second extra)) (getf indexes (first extra)))
                   (setf (getf indexes (or (second extra) (first extra))) index))
                 (push (logior (ash 1 index)
                               (if (second extra)
                                   (ash 1 (position (second extra) *gcontext-components*))
                                   0))
                       masks)
                 (incf index))
               `(within-definition (def-gc-internals ,name)
                  ,@(nreverse macros)
                  (eval-when (:execute :compile-toplevel :load-toplevel)
                    (defparameter *gcontext-data-length* ,index)
                    (defparameter *gcontext-indexes* ',indexes)
                    (defparameter *gcontext-masks*
                      ',(coerce (nreverse masks) 'simple-vector)))))))
  (def-gc-internals ignore
    (:clip :clip-mask) (:dash :dashes) (:font-obj :font) (:timestamp)))