unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Davis Herring" <herring@lanl.gov>
To: "Stephen J. Turnbull" <stephen@xemacs.org>
Cc: Leo <sdl.web@gmail.com>, emacs-devel@gnu.org
Subject: Re: Is (provide 'foo) at the start good or bad?
Date: Sun, 14 Jun 2009 12:30:16 -0700 (PDT)	[thread overview]
Message-ID: <51511.130.55.118.19.1245007816.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <87eitowck5.fsf@uwakimon.sk.tsukuba.ac.jp>

>  > If you have two files which require each other, why do they each have a
>  > feature symbol?
>
> Because external packages don't know about the mutual dependency, and
> shouldn't have to.  Multiple versions of the files may support the
> same interfaces, some with and some without mutual dependency.  Etc.

That was case #3, wasn't it?  Once you have such a dependency, you might
as well (internally, for development) treat the two files as one package. 
I didn't mean to imply that you never needed two symbols -- that's why I
gave solutions, for each case that I could think of, that didn't involve
putting `provide' at the top.

>  > Put differently, `provide' is supposed to "Announce that FEATURE is a
>  > feature of the current Emacs.".  If you put it at the beginning of a
>  > package, you're lying (until the end of it).
>
> Sure.  There are other standard techniques that involve such "lying",
> like `(defvar foo)', which does exactly the same kind of thing that a
> provide at the top does.  In both cases, there may be a path through
> the code leaves something uninitialized.

But the only thing which can even tell that (defvar foo) was present is
the byte-compiler; we know all about how to lie to it safely.  `provide'
has a globally-visible effect (that's its whole purpose!), so arbitrary
code may react badly if we lie when we use it.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




  reply	other threads:[~2009-06-14 19:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11 12:56 Is (provide 'foo) at the start good or bad? William Xu
2009-06-11 17:01 ` Leo
2009-06-12  4:09   ` Stephen J. Turnbull
2009-06-12  5:01     ` William Xu
2009-06-12 10:02       ` Thien-Thi Nguyen
2009-06-12 10:26       ` Stephen J. Turnbull
2009-06-12 15:15         ` William Xu
2009-06-12  8:36     ` Alan Mackenzie
2009-06-12 10:10       ` Stephen J. Turnbull
2009-06-12 23:00     ` Davis Herring
2009-06-13 12:19       ` Stephen J. Turnbull
2009-06-14 19:30         ` Davis Herring [this message]
2009-06-15  3:04           ` Stephen J. Turnbull
2009-06-15 18:20             ` Davis Herring
2009-06-16  3:47               ` Stephen J. Turnbull
2009-06-12 21:16 ` 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=51511.130.55.118.19.1245007816.squirrel@webmail.lanl.gov \
    --to=herring@lanl.gov \
    --cc=emacs-devel@gnu.org \
    --cc=sdl.web@gmail.com \
    --cc=stephen@xemacs.org \
    /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).