[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is (provide 'foo) at the start good or bad?
From: |
Davis Herring |
Subject: |
Re: Is (provide 'foo) at the start good or bad? |
Date: |
Sun, 14 Jun 2009 12:30:16 -0700 (PDT) |
User-agent: |
SquirrelMail/1.4.8-5.7.lanl1 |
> > 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.
- Re: Is (provide 'foo) at the start good or bad?, (continued)
- Re: Is (provide 'foo) at the start good or bad?, Alan Mackenzie, 2009/06/12
- Re: Is (provide 'foo) at the start good or bad?, Stephen J. Turnbull, 2009/06/12
- Re: Is (provide 'foo) at the start good or bad?, Davis Herring, 2009/06/12
- Re: Is (provide 'foo) at the start good or bad?, Stephen J. Turnbull, 2009/06/13
- Re: Is (provide 'foo) at the start good or bad?,
Davis Herring <=
- Re: Is (provide 'foo) at the start good or bad?, Stephen J. Turnbull, 2009/06/14
- Re: Is (provide 'foo) at the start good or bad?, Davis Herring, 2009/06/15
- Re: Is (provide 'foo) at the start good or bad?, Stephen J. Turnbull, 2009/06/15
Re: Is (provide 'foo) at the start good or bad?, Stefan Monnier, 2009/06/12