help-gnu-emacs
[Top][All Lists]
Advanced

[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 ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]