GNU bug report logs -
#13813
24.3.50; eval-and-compile in macro inhibits let-binding of variable
Previous Next
Reported by: David Engster <deng <at> randomsample.de>
Date: Mon, 25 Feb 2013 17:01:02 UTC
Severity: normal
Tags: notabug
Found in version 24.3.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Stefan Monnier writes:
> OK, you got me, I admit it,
Ha! No one can escape the EIEIO testsuite!
> I changed recently eval-and-compile to be (in effect)
> eval-during-load-and-compile. I could turn it into a
> eval-during-eval-load-and-compile, but then your above test would run
> `mytestfun' twice (once with myflag=nil and then once with myflag=t)
> which I don't think would please everyone either.
Yep, my gut says that would create problems in EIEIO, too.
>> * Note the following:
>> - It works if you just 'setq' the 'myflag' variable
>
> But not if you (progn (setq myflag t) (mytestmacro)).
True. I didn't test that.
>> And yes, Stefan, this bug turned up in the EIEIO test suite. :-)
>
> Could you give some details, so we can better assess the best solution?
There is a flag called `eieio-error-unsupported-class-tags' which makes
`eieio-defclass' signal an error if a tag is unsupported. Since
`eieio-defclass' is the implementation of the `defclass' macro (wrapped
in `eval-and-comopile'), this flag has no effect if it is set in a
let-binding. To be specific, the test checks that this
(let ((eieio-error-unsupported-class-tags t))
(defclass class-error ()
((error-slot :initarg :error-slot
:badslottag 1))
"A class with a bad slot tag."))
is throwing an error.
> BTW, I think eval-and-compile should only be used to wrap definitions.
> Anything else is asking for trouble.
As I said: I can't wrap my head around that stuff. But the Emacs Lisp
manual specifically mentions this use case for `eval-and-compile'.
Out of curiosity I removed the `eval-and-compile' and everything seems
to work fine, which just adds to my confusion.
-David
This bug report was last modified 12 years and 77 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.