1

Why can't I expand a macro inside (quail-define-rules)?

(defmacro quail-test ()
    `("c" ["success!"]))

(quail-define-package "experiment" "Experiment" "X" t
                                            "Just an experiment."
                                            nil t t nil nil nil nil nil nil nil t)
(quail-define-rules
 ("a" ?!)
 ("b" ["circus"])
 (quail-test))
1
  • I'm not familiar with quail-define-rules, but it sounds like a problem that a lot of macros have. Well, not so much of a problem as misconception about how they must be used. The way macros are expanded is by repeatedly calling macroexpand, so one macro can produce a tree with macros in it, and it will be expanded on the next cycle. However, macros rarely call macroexpand during their own expansion. The later is uncommon, and if a macro does that, it will usually mention it in its documentation. Think about macros as defining syntax rules, then you'd see that (quail-test) is invalid.
    – wvxvw
    Commented Dec 20, 2017 at 6:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.