all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Phil Sainty <psainty@orcon.net.nz>,
	49116@debbugs.gnu.org, bugs@gnu.support
Subject: bug#49116: 28.0.50; Why `bound-and-true-p' is not working in lexical binding?
Date: Mon, 21 Jun 2021 19:00:26 +0200	[thread overview]
Message-ID: <87sg1b2lw5.fsf@web.de> (raw)
In-Reply-To: <87tuluyopg.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 19 Jun 2021 15:21:47 +0200")

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I've now copied over that text to the doc string of bound-and-true-p.

You now changed the text to this:

> Return the value of symbol VAR if it is bound, else nil.
> Note that if `lexical-binding' is in effect, this function isn't
> meaningful if it refers to a lexically bound variable.

If you want feedback: I found this new version confusing, although it's
totally correct.  Because in my mental model, `bound-and-true-p' just
receives a variable (i.e. internally quotes), so how _can_ it even
"refer" to the lexical variable at all?

But it is true:

#+begin_src emacs-lisp
(let* ((a 1)
       (get-a (lambda () (list a (bound-and-true-p a)))))
  (dlet ((a 2))
    (funcall get-a))) ;; -> (1 1), not (1 2) as one might expect
#+end_src

Everything became clear when I looked at the implementation ;-)

Maybe we can further improve the text to something like "not meaningful
in the scope of a lexical binding of the variable" or something like
that?


Thanks,

Michael.





  reply	other threads:[~2021-06-21 17:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19 11:39 bug#49116: 28.0.50; Why `bound-and-true-p' is not working in lexical binding? Jean Louis
2021-06-19 12:49 ` Phil Sainty
2021-06-19 12:54   ` Eli Zaretskii
2021-06-19 13:01     ` Lars Ingebrigtsen
2021-06-19 13:13     ` Phil Sainty
2021-06-19 13:21       ` Lars Ingebrigtsen
2021-06-21 17:00         ` Michael Heerdegen [this message]
2021-06-22 12:59           ` Lars Ingebrigtsen
2021-06-22 23:00 ` Michael Heerdegen

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=87sg1b2lw5.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=49116@debbugs.gnu.org \
    --cc=bugs@gnu.support \
    --cc=larsi@gnus.org \
    --cc=psainty@orcon.net.nz \
    /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.