[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Evaluation of macro arguments

From: Marcin Borkowski
Subject: Evaluation of macro arguments
Date: Tue, 05 Jan 2016 11:59:24 +0100
User-agent: mu4e 0.9.13; emacs

Hi all,

continuing my quest to grok macro argument evaluation issues, I'd like
(again) to make sure that I get it correctly.  So I have this simple
macro generating a list of consecutive numbers (which is not without
problems - I am aware of those, namely (i) it uses hard-coded symbols
instead of generating them on the fly, and (ii) it has no error

(defmacro range (from dir to)
  `(let ((delta (cond ((eq ',dir 'upto) 1)
                      ((eq ',dir 'downto) -1)))
         (i ,from)
         (list nil))
     (while (not (= i ,to))
       (push i list)
       (setq i (+ i delta)))
     (nreverse list)))

Do I get it correctly that if I want to write an Edebug spec for this
macro, I should mark the second argument as _not evaluated_, because its
value is actually quoted?

(Also, do I get it right that the spec for the second argument should be
e.g. `symbolp', or - if I want to have more error-checking while
edebugging - I should _define_ a predicate like this

(defun upto-or-downto-p (symbol)
  (memq symbol '(upto downto)))

since the predicate in the edebug spec cannot be a lambda expression?


Marcin Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

reply via email to

[Prev in Thread] Current Thread [Next in Thread]