From: Bob Rogers <rogers-emacs@rgrjr.dyndns.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Dan Nicolaescu <dann@ics.uci.edu>, emacs-devel@gnu.org
Subject: Re: byte compiler warnings when bootstrapping
Date: Sun, 21 Oct 2007 19:24:10 -0400 [thread overview]
Message-ID: <18203.57242.853567.977596@rgrjr.dyndns.org> (raw)
In-Reply-To: <jwv1wbos21l.fsf-monnier+emacs@gnu.org>
From: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Sun, 21 Oct 2007 15:38:06 -0400
. . .
Along similar lines I'd like to add a
(require-lazily <feature>)
which would behave similarly to `require' except that the byte-compiler
would replace it with a bunch of autoloads. so the package would only be
"required" when one of its functions was used.
In any case, for the issue of "dependencies" (e.g. calling
`Info-read-node-name' after `info', or calling `help-buffer' after
`help-setup-xref') I'm not sure what we should ideally do, but the
require-lazily seems like an acceptable solution.
Stefan
Since (IIUC) these are "internal" functions in one package that are
called from another, it seems better to mark them as such at the point
of definition, rather than in some random place in the files that call
them.
For example, suppose we defined a ";;;API" tag line (or preferably
something less cryptic) to put before the definitions of functions that
are called elsewhere, by analogy with ";;;AUTOLOAD". Then, a function
like batch-update-autoloads could be written that extracted these tagged
definitions into "declare-function" forms, building an "api-defs.el"
file that would be loaded into batch-byte-compile jobs in order to
suppress the "undefined function" warnings without requiring them to be
loaded. This also has the benefit of explicitly identifying function
definitions that are used elsewhere within Emacs, despite seeming to be
internal, as a warning to people who might otherwise carelessly change
their interface.
Given that much, it then ought to be trivial for the byte compiler to
insert
(or (fbound 'foo-api-function)
(require 'foo))
(or something similar to what autoloading does) before the point of call
for each such function, giving the same effect as "require-lazily".
Note that "api-defs.el" would not be loaded into emacs except when
compiling, nor would it ever be installed. That way, these "internal
API" functions would remain internal as far as non-Emacs packages are
concerned.
Thoughts?
-- Bob Rogers
http://rgrjr.dyndns.org/
next prev parent reply other threads:[~2007-10-21 23:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-21 7:38 byte compiler warnings when bootstrapping Dan Nicolaescu
2007-10-21 9:50 ` martin rudalics
2007-10-22 9:00 ` Richard Stallman
2007-10-22 20:25 ` Eli Zaretskii
2007-10-23 10:39 ` Richard Stallman
2007-10-21 14:05 ` Stefan Monnier
2007-10-21 15:58 ` Dan Nicolaescu
2007-10-21 16:15 ` David Kastrup
2007-10-21 16:33 ` Dan Nicolaescu
2007-10-21 18:44 ` David Kastrup
2007-10-21 19:38 ` Stefan Monnier
2007-10-21 23:24 ` Bob Rogers [this message]
2007-10-23 7:12 ` Richard Stallman
2007-10-23 7:12 ` Richard Stallman
2007-10-23 14:21 ` Stefan Monnier
2007-10-24 2:49 ` Richard Stallman
2007-10-24 3:49 ` Stefan Monnier
2007-10-25 2:10 ` Richard Stallman
2007-10-23 14:23 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18203.57242.853567.977596@rgrjr.dyndns.org \
--to=rogers-emacs@rgrjr.dyndns.org \
--cc=dann@ics.uci.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).