all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Evaluation of macro arguments
@ 2016-01-05 10:59 Marcin Borkowski
  2016-01-05 12:55 ` Stefan Monnier
  2016-01-05 19:22 ` Pascal J. Bourguignon
  0 siblings, 2 replies; 10+ messages in thread
From: Marcin Borkowski @ 2016-01-05 10:59 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

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
checking):

(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?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-01-14 23:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-05 10:59 Evaluation of macro arguments Marcin Borkowski
2016-01-05 12:55 ` Stefan Monnier
2016-01-13 22:16   ` Marcin Borkowski
2016-01-14 13:47     ` Stefan Monnier
2016-01-14 20:32       ` Marcin Borkowski
2016-01-14 23:05         ` Stefan Monnier
2016-01-05 19:22 ` Pascal J. Bourguignon
2016-01-05 19:39   ` Marcin Borkowski
2016-01-05 20:30     ` Marcin Borkowski
     [not found]     ` <mailman.1794.1452025850.843.help-gnu-emacs@gnu.org>
2016-01-08 23:13       ` duthen.mac.01

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.