From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Qiantan Hong <qhong@mit.edu>
Cc: Arthur Miller <arthur.miller@live.com>,
"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Generic autoloading? [Was Patch: perform autoloading when docs is missing from autoload object]
Date: Fri, 17 Sep 2021 15:36:33 -0400 [thread overview]
Message-ID: <jwv5yuzf1jf.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <2ABC3C0C-CBF7-44D9-B498-B548F820B125@mit.edu> (Qiantan Hong's message of "Fri, 17 Sep 2021 16:56:34 +0000")
> Just in case, is it possible to provide a generic autoload mechanism
> that run arbitrary function to load the missing function,
> instead of hardcoded to basically a REQUIRE?
I think if it doesn't end up loading a file, and isn't bound to
the `symbol-function` cell of a symbol, then it's probably too different
from our autoloads to be worth trying to shoehorn it into the existing system.
> Currently I can fake it with a closure that knows where it is
> and replace itself once called.
I think the fix is to remove the word "fake" in the description ;-)
> But it feels like reimplementing the same thing twice.
I haven't looked at your code, but if what you fetch lazily is itself
a function, then I suspect that your "faking code" is clean, short, and
reliable, and there isn't much to share with the autoload code (other
than a philosophical similarity).
> (I think current autoload can also be implemented in pure Elisp
> in this way,
More or less, yes (tho it gets more costly in terms of heap usage).
Also, we have accrued various subtle details that are inconvenient to
mimic (e.g. various places call `autoload-do-load` manually rather than
just calling the function in order to get a bit more control over what
happens when).
Stefan
next prev parent reply other threads:[~2021-09-17 19:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 13:51 Patch: perform autoloading when docs is missing from autoload object Arthur Miller
2021-09-15 18:14 ` Stefan Monnier
2021-09-15 22:29 ` Arthur Miller
2021-09-17 16:38 ` Stefan Monnier
2021-09-17 16:56 ` Generic autoloading? [Was Patch: perform autoloading when docs is missing from autoload object] Qiantan Hong
2021-09-17 19:36 ` Stefan Monnier [this message]
2021-09-17 19:51 ` Qiantan Hong
2021-09-17 21:25 ` Arthur Miller
2021-09-17 21:09 ` Patch: perform autoloading when docs is missing from autoload object Arthur Miller
2021-09-18 13:37 ` Stefan Monnier
2021-09-18 18:25 ` Arthur Miller
2021-09-20 17:02 ` Stefan Monnier
2021-09-22 16:18 ` Arthur Miller
2021-09-16 12:51 ` Lars Ingebrigtsen
2021-09-17 6:49 ` Arthur Miller
2021-09-17 14:01 ` Lars Ingebrigtsen
2021-09-17 15:04 ` Arthur Miller
2021-09-18 13:21 ` Lars Ingebrigtsen
2021-09-18 16:03 ` [External] : " Drew Adams
2021-09-18 17:34 ` Arthur Miller
2021-09-18 17:31 ` Arthur Miller
2021-09-18 17:53 ` Lars Ingebrigtsen
2021-09-18 18:38 ` Arthur Miller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv5yuzf1jf.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=arthur.miller@live.com \
--cc=emacs-devel@gnu.org \
--cc=qhong@mit.edu \
/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 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.