emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is (provide 'foo) at the start good or bad?


From: Stephen J. Turnbull
Subject: Re: Is (provide 'foo) at the start good or bad?
Date: Mon, 15 Jun 2009 12:04:44 +0900

Davis Herring writes:

 > >  > 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?

No.  You're missing the "multiple versions" case.  (Although GNU Emacs
prefers to "support" 3rd party libraries by incorporating them, other
Emacsen try to support third parties as independent projects, and that
doesn't necessarily mean there's a blessed third party for each such
library, either.)

 > Once you have such a dependency, you might as well (internally, for
 > development)

You and I don't internally share a heart, and there's similarly no
reason to suppose the libraries are jointly developed, not even the
multiple versions of a single library.

 > >  > 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.

If you need to lie in programming, something is broken, and by
definition that's not safe.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]