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: Stefan Monnier
Subject: Re: To `boundp' or not to `boundp'?
Date: Tue, 01 Sep 2015 22:12:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> (when (and (boundp 'xxx-mode) xxx-mode)
>   ...)
> I personally prefer to do it shorter
> (when (ignore-errors xxx-mode)
>   ...)
> Are those equivalent?

Kinda.  I think ignore-errors has a higher cost than boundp+and, but the
more important difference is that ignore-errors will hide all kinds of
other errors, so its use generally makes debugging your code harder.
For that reason I generally prefer to avoid it.


        Stefan




reply via email to

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