unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 27674@debbugs.gnu.org
Subject: bug#27674: 26.0.50; cl-progv: strange scoping due to implementation
Date: Wed, 12 Jul 2017 20:21:39 -0400	[thread overview]
Message-ID: <87r2xldw4s.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87lgntfhky.fsf@drachen> (Michael Heerdegen's message of "Wed, 12 Jul 2017 23:53:01 +0200")

Michael Heerdegen <michael_heerdegen@web.de> writes:

> The way `cl-progv' is implemented, we have some strange effects
> happening to closures in the body.  For example, with lexical-binding
> on,
>
> (let ((x 0))
>   (cl-progv (list 'x) (list 1)
>     (funcall (lambda () x))))
>
> yields 0, and
>
> (cl-progv (list 'x) (list 1)
>   (funcall (lambda () x)))
>
> yields 1.  That isn't consistent (FWIW I would expect `1' in both
> cases).

IMO, this is a bug in your program, this yields 1:

(progn
  (defvar x)
  (let ((x 0))
    (cl-progv (list 'x) (list 1)
      (funcall (lambda () x)))))

Note that your second expression gives a compile warning (it's also
missing a defvar, though it happens to give the result you expect even
without that):

27674.el:10:25:Warning: reference to free variable ‘x’





  reply	other threads:[~2017-07-13  0:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 21:53 bug#27674: 26.0.50; cl-progv: strange scoping due to implementation Michael Heerdegen
2017-07-13  0:21 ` npostavs [this message]
2017-07-13  0:36   ` Michael Heerdegen
2017-07-13  0:50     ` npostavs
2017-07-13  1:11       ` Michael Heerdegen
2017-07-13  1:54         ` npostavs
2017-07-13  2:15           ` Michael Heerdegen
2017-07-13  2:41             ` npostavs
2017-07-13 14:40               ` Roland Winkler
2017-07-13 15:07                 ` Noam Postavsky
2017-07-14 14:20                   ` Michael Heerdegen
2017-07-15 20:46                     ` Roland Winkler
2017-07-14 16:00               ` Michael Heerdegen
2017-07-19 13:55             ` 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=87r2xldw4s.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=27674@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /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).