[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master e910ef3: Improve bound-and-true-p doc string
From: |
Lars Ingebrigtsen |
Subject: |
Re: master e910ef3: Improve bound-and-true-p doc string |
Date: |
Sun, 20 Jun 2021 13:51:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Hmm... the `boundp` indeed checks the binding of the dynvar of that
> name, but the subsequent var reference will actually return the lexical
> binding if there's one:
>
> (eval '(let ((sm-foo 4)) (set 'sm-foo 0) (bound-and-true-p sm-foo)) t)
> =>
> 4
Oh yeah -- it's not really a meaningful function at all when referring
to a lexically bound variable. I've now updated the doc string further.
> I suspect that `boundp` should signal a warning when compiling such code
> because using `boundp` or `bound-and-true-p` within the lexical scope of
> a var with the same name seems like a good hint that the coder is
> quite confused.
Yes, sounds like a good idea.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no