all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Byte compiler and eval-when-compile
@ 2012-10-15 16:23 David Engster
  2012-10-15 18:41 ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: David Engster @ 2012-10-15 16:23 UTC (permalink / raw)
  To: emacs-devel

Somehow the byte compiler got smart during the last days (I think it's
the change in rev. 110510). I now get a lot more 'function X might not
be defined at runtime' warnings than before. The reason seems to be that
it better checks if `eval-when-compile' was used properly. Which is fine
and all, but I now have the following problem:

In CEDET, we often use `require' statements in function bodies, like
this:

(defun test()
  (require 'eldoc)
  (message "%s" (eldoc-function-argstring '("foo" "bar"))))

The reason is simply to only do the require when it is actually needed,
so that startup time is reduced. Still, if you byte-compile the above,
you'll get a 'might not be defined at runtime' warning for
`eldoc-function-argstring'. I used to circumvent that problem by simply
doing

(eval-when-compile
  (require 'eldoc))

Before you scream at me: I *know* this is not what `eval-when-compile'
is for, but it has worked until a few days ago. It seems the
byte-compiler now sees that I'm actually using a function from eldoc,
but he still doesn't see that I'm requiring the package it in the
function body. Do I now really have to use `declare-function' for all
those cases?

-David



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

end of thread, other threads:[~2012-10-19  0:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-15 16:23 Byte compiler and eval-when-compile David Engster
2012-10-15 18:41 ` Stefan Monnier
2012-10-15 19:26   ` David Engster
2012-10-16  0:58     ` Stefan Monnier
2012-10-18 18:55       ` David Engster
2012-10-18 19:53         ` Glenn Morris
2012-10-18 20:07           ` David Engster
2012-10-18 20:11           ` Glenn Morris
2012-10-18 20:15             ` David Engster
2012-10-19  0:38         ` Stefan Monnier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.