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: Drew Adams
Subject: RE: To `boundp' or not to `boundp'?
Date: Tue, 1 Sep 2015 11:00:23 -0700 (PDT)

> > If they really wanted a macro for this, it should have been called
> > something that reflects what it does, e.g., `var-value-or-nil' or
> > `if-bound-then-value-else-nil'.
> 
> One needs this quite often, so it's good to factor it out.

And so it was.  I'm not convinced it helps.  But if it helps you, great.
(and (boundp 'VAR) VAR) works for me.

> I've no strong opinion about the name, but I guess the macro was indeed
> intended for cases where the return value is used as a boolean.  There
> are other use cases where the name then is confusing.  Maybe
> `symbol-value-safe' in analogy to `car-safe' would be better?  Then it
> would have to be a function, though.

I don't see why it would have to be a function, just due to a name
change.  But the name is what it is, and likely won't be changed.

(And whatever the name, I will likely use (and (boundp 'VAR) VAR).)



reply via email to

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