unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Is add-to-list supposed to work when lexical-binding is t?
Date: Thu, 13 Jun 2013 10:57:46 -0400	[thread overview]
Message-ID: <jwvr4g6dq5b.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.1450.1370998793.22516.help-gnu-emacs@gnu.org

>>> 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	other threads:[~2013-06-13 14:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1450.1370998793.22516.help-gnu-emacs@gnu.org>
2013-06-13 14:57 ` Stefan Monnier [this message]
2013-06-12  0:59 Is add-to-list supposed to work when lexical-binding is t? Kelly Dean
     [not found] <mailman.1311.1370828650.22516.help-gnu-emacs@gnu.org>
2013-06-10  5:12 ` Barry Margolin
  -- strict thread matches above, loose matches on Subject: below --
2013-06-10  1:43 Kelly Dean
2013-06-10  7:56 ` Stefan Monnier
2013-06-05 23:12 Kelly Dean
2013-06-06  0:42 ` Stefan Monnier
2013-06-04  0:42 Kelly Dean
2013-06-04  1:49 ` Stefan Monnier
2013-06-04 15:24   ` PJ Weisberg
2013-06-05  2:41     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr4g6dq5b.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).