unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel@gnu.org
Subject: Re: need for 'dynamical-let'?
Date: Thu, 23 Jul 2015 15:58:26 -0500	[thread overview]
Message-ID: <86wpxqd219.fsf@stephe-leake.org> (raw)
In-Reply-To: <861tfyegrg.fsf@stephe-leake.org> (Stephen Leake's message of "Thu, 23 Jul 2015 15:54:59 -0500")

Stephen Leake <stephen_leake@stephe-leake.org> writes:

> I'm switching on lexical-binding in some files.
>
> In several cases, the byte compiler is complaining:
>
> xgit.el:993:30:Error: add-to-list cannot use lexical var `branch-list'
>
> So I have to change code like this:
>
> (let (branch-list
>       ...)
>    (add-to-list branch-list (substring branch-entry 2) t)
>
>
> to:
>
> (defvar dvc-branch-list);; add-to-list can't use lexical var
> (let (
>       ...)
>    (add-to-list 'dvc-branch-list (substring branch-entry 2) t)
>
>
> This pollutes the global name space, and disguises the local nature of
> 'branch-list'.
>
> Can we define a macro 'dynamical-let' that would implement this
> pattern, but with hidden variables?


Also, how do I know which functions I write also can't use lexical
variables? Using 'symbol-value' would be one clue, apparently. I hope
the byte-compiler will complain?

-- 
-- Stephe



  reply	other threads:[~2015-07-23 20:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 20:54 need for 'dynamical-let'? Stephen Leake
2015-07-23 20:58 ` Stephen Leake [this message]
2015-07-23 21:03 ` Dmitry Gutov
2015-07-24  8:16   ` Stephen Leake
2015-07-24  9:38     ` Dmitry Gutov
2015-07-24  4:23 ` Stephen J. Turnbull
2015-07-24  4:40   ` David Kastrup
2015-07-24  7:58   ` Stephen Leake
2015-07-24 16:54 ` Dmitri Paduchikh
2015-07-25  6:41   ` Dmitri Paduchikh
2015-07-25 22:22     ` Stefan Monnier
2015-07-26  0:02       ` Dmitri Paduchikh
2015-07-26  6:51         ` Stefan Monnier
2015-07-26  8:17           ` Dmitri Paduchikh
2015-07-26 15:37         ` raman
2015-07-24 23:32 ` 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=86wpxqd219.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).