[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: To `boundp' or not to `boundp'?
From: |
Barry Margolin |
Subject: |
Re: To `boundp' or not to `boundp'? |
Date: |
Tue, 01 Sep 2015 16:20:10 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.331.1441125765.19560.help-gnu-emacs@gnu.org>,
Drew Adams <drew.adams@oracle.com> wrote:
> > > I often see code like this
> > > (when (and (boundp 'xxx-mode) xxx-mode) ...)
> >
> > The "proper" way to do that is to use bound-and-true-p.
>
> That certainly is *not* proper for the more general case
> (and (boundp 'xxx) xxx), where the value of `xxx' is
> not necessarily Boolean or is not used only as a Boolean.
>
> Well, it works the same, but the _name misleads_ terribly
> in this case, even if the doc does let you know that the
> variable value (not t or nil) is returned, when bound.
The name isn't misleading if you use it in a boolean context, like the
WHEN call in the OP.
It's no more misleading than MEMBER, which intuitively seems like it
would just return a boolean, but actually returns the tail of the list
where the element was found.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
- To `boundp' or not to `boundp'?, Alexander Shukaev, 2015/09/01
- Re: To `boundp' or not to `boundp'?, Dmitry Gutov, 2015/09/01
- Message not available
- Re: To `boundp' or not to `boundp'?,
Barry Margolin <=
- RE: To `boundp' or not to `boundp'?, Drew Adams, 2015/09/01
- member returns list (was: Re: To `boundp' or not to `boundp'?), Emanuel Berg, 2015/09/01
- RE: member returns list (was: Re: To `boundp' or not to `boundp'?), Drew Adams, 2015/09/01
- Re: member returns list (was: Re: To `boundp' or not to `boundp'?), Emanuel Berg, 2015/09/01
- RE: member returns list (was: Re: To `boundp' or not to `boundp'?), Drew Adams, 2015/09/01
- Re: member returns list (was: Re: To `boundp' or not to `boundp'?), Emanuel Berg, 2015/09/01
- RE: member returns list (was: Re: To `boundp' or not to `boundp'?), Drew Adams, 2015/09/02
- Re: member returns list (was: Re: To `boundp' or not to `boundp'?), Emanuel Berg, 2015/09/02
- Message not available
- Re: member returns list, Pascal J. Bourguignon, 2015/09/03
- Re: member returns list, Emanuel Berg, 2015/09/03