On 2011-08-25 20:25 +0200, Štěpán Němec wrote:
On Thu, 25 Aug 2011 19:12:20 +0200 Vegard Øye wrote:
Emacs signals the error "Variable binding depth exceeds max-specpdl-size":
(setq x `#1=(a #1#))
Then there's the case of self-referential lambda functions. If you write the function below, how will it byte-compile?
'#1=(lambda () #1#)
I don't think there is anything surprising about either of your examples: both ``' and `lambda' are macros, so if you create a cycle, it expands and expands and expands and expands and expands... you get the idea.
Ah, so /that's/ what's going on. Well, for what it's worth, the lambda issue can be resolved then. This enters an infinite regress: (macroexpand-all '#1=(lambda () #1#)) But the following does not, since quoting the inner reference prevents further expansion: (macroexpand-all '#1=(lambda () '#1#)) One can also avoid the backquote issue by constructing the list in parts and using `nconc' to piece them together.
OTOH, if I understand correctly, Tim said that his Emacs crashed. No matter what you do in Elisp, Emacs should never crash, so that would definitely be a candidate for `report-emacs-bug'.
Indeed. This should be sufficient to reproduce it: (eval-after-load 'comint '(define-key comint-mode-map "a" comint-mode-map)) In any case, I'll consider self-referential structures a big no-no from now on. -- Vegard