help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Is add-to-list supposed to work when lexical-binding is t?


From: Stefan Monnier
Subject: Re: Is add-to-list supposed to work when lexical-binding is t?
Date: Thu, 13 Jun 2013 10:57:46 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>>> I don't see cases where quote-var would fail to do what's intended.
>> We can have gv-ref/quote-var/quote-lex/younameit, but what we can't do
>> is merge it with quote, because their semantics are incompatible:
>> (eq (let ((x 1)) (quote-var x)) (let ((x 1)) (quote-var x)))
>> should return nil, whereas
>> (eq (let ((x 1)) (quote x)) (let ((x 1)) (quote x)))
>> should return t.
> True, and that's a good way to explain the difference between a variable
> and a symbol.

And more importantly, it explains why we can't just blindly replace 'x
with (quote-lex x).  So there's no way to automatically and reliably
make things like add-to-list/set/run-hooks/symbol-value/... work.

BTW, I started to use a local hack which compiles all files in
lexical-binding mode (hence bumping into all those problems).
Some problematic cases are even more impossible for the compiler to
auto-handle (see for example in auth-source.el):

  (let* ((base-required '(host user port secret))
    [...]
    (dolist (br base-required)
      (when (symbol-value br)

So now you'd need a quote-lex which doesn't work only to quote symbols
but even lists of symbols (and I wouldn't be surprised to find places
where a vector is used instead, or where the list is itselfs generated).


        Stefan


reply via email to

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