From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel@gnu.org
Subject: byte-compiler warn on quote lexical var?
Date: Tue, 04 Aug 2015 09:01:03 -0500 [thread overview]
Message-ID: <86a8u7dug0.fsf@stephe-leake.org> (raw)
I've posted bug#21185; it suggests that the byte-compiler should warn
when a lexical variable is quoted.
For example, with this code:
;; -*- lexical-binding: t -*-
(defun display-var (var)
"Display variable value of VAR (a symbol), if any."
(cond
((boundp var)
(message "%s: %s" (symbol-name var) (symbol-value var)))
(t
(message "%s not bound" (symbol-name var)))))
(defun quote-lexical-var ()
(let ((my-var "foo"))
(message "non-quoted my-var: %s" my-var)
(display-var 'my-var)))
the call to 'display-var' reports "not bound".
I've been bitten by this problem a couple of times when porting code to
lexical binding; I'd like the byte-compiler to warn me about it.
Is that reasonable?
Can anyone point me to where in the byte-compiler code I should look to
start working on adding this?
--
-- Stephe
next reply other threads:[~2015-08-04 14:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 14:01 Stephen Leake [this message]
2015-08-08 13:57 ` byte-compiler warn on quote lexical var? 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86a8u7dug0.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--cc=emacs-devel@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.
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.