From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: Nathaniel Flath <flat0103@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Should require and provide be symmetrical?
Date: Wed, 10 Feb 2010 11:48:34 +0900 [thread overview]
Message-ID: <87tytpyfel.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <5e3a506e1002091729u3d70ed8bt2350c57b5d480f14@mail.gmail.com>
Nathaniel Flath writes:
> I came across a problem with require and provide that seems rather
> counterintuitive, although it is implicit in the documentaiton. If one file
> provides a feature with (provide 'feature) and another requires it, there is
> no guarantee that that specific file is loaded, even if no other file calls
> (provide 'feature).
How do you propose that Emacs would know this? N.B. In general there
are usually at least two files that provide any feature (the .el and
its corresponding .elc).
> I ran into this whil splitting up my personal configuration - I was
> attempting to mirror the packages I was loading, so for example
> org.el in my directory would contain customizations for org-mode.
> However, in this file, a (require 'org) would cause an infinite
> require error, as it tried to load itself instead of the org.el in
> emacs. Should this behaviour be changed, or is there a reason for
> it?
You'd have to change the loader to parse the file without loading it.
Yuck. Then, if you get a provide error, you have to keep walking the
load-path to the very end in hopes of find one that does do a provide.
This is still (Big-O (length load-path)), but your coefficient has
been pessimized. Yuck. And now we have to maintain state for error-
reporting (a list of tried-and-failed org.el and org.elc files).
Double-yuck.
So, no, I can see no positive reason for the behavior, but I can see
lots of reasons not to change the implementation. If I were you, I'd
just put those configs somewhere that isn't on load-path.
next prev parent reply other threads:[~2010-02-10 2:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-10 1:29 Should require and provide be symmetrical? Nathaniel Flath
2010-02-10 2:44 ` chad
2010-02-10 2:48 ` Stephen J. Turnbull [this message]
2010-02-10 18:27 ` Andreas Schwab
2010-02-10 19:12 ` Harald Hanche-Olsen
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=87tytpyfel.fsf@uwakimon.sk.tsukuba.ac.jp \
--to=stephen@xemacs.org \
--cc=emacs-devel@gnu.org \
--cc=flat0103@gmail.com \
/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).