unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [ELPA-diffs] /srv/bzr/emacs/elpa r342: New package ggtags
       [not found] <E1U0vtC-0006Gd-Dz@vcs.savannah.gnu.org>
@ 2013-01-31 16:02 ` Stefan Monnier
  2013-01-31 18:03   ` Leo Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2013-01-31 16:02 UTC (permalink / raw)
  To: Leo Liu; +Cc: emacs-devel

> +(defmacro ggtags-ensure-global-buffer (&rest body)
> +  (declare (indent 0))
> +  `(progn
> +     (assert (and (buffer-live-p compilation-last-buffer)
> +                  (with-current-buffer compilation-last-buffer
> +                    (derived-mode-p 'ggtags-global-mode)))
> +             nil "No global buffer found")
> +     (with-current-buffer compilation-last-buffer ,@body)))

I think this is a misuse of `assert'.  An `assert' should be used for
something that should *never* be false (i.e. if it is false, we have
a bug, possibly in the assertion itself).  This is reflected in the fact
that depending on optimization levels, CL can be told to "optimize-away"
the assertions.

So I think you want to use an explicit "test + error" above.


        Stefan



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ELPA-diffs] /srv/bzr/emacs/elpa r342: New package ggtags
  2013-01-31 16:02 ` [ELPA-diffs] /srv/bzr/emacs/elpa r342: New package ggtags Stefan Monnier
@ 2013-01-31 18:03   ` Leo Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Liu @ 2013-01-31 18:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 2013-02-01 00:02 +0800, Stefan Monnier wrote:
> I think this is a misuse of `assert'.  An `assert' should be used for
> something that should *never* be false (i.e. if it is false, we have
> a bug, possibly in the assertion itself).  This is reflected in the fact
> that depending on optimization levels, CL can be told to "optimize-away"
> the assertions.
>
> So I think you want to use an explicit "test + error" above.

Thanks. I have fixed them.

Leo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-31 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1U0vtC-0006Gd-Dz@vcs.savannah.gnu.org>
2013-01-31 16:02 ` [ELPA-diffs] /srv/bzr/emacs/elpa r342: New package ggtags Stefan Monnier
2013-01-31 18:03   ` Leo Liu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).