[comp.emacs] require & provide

pauld@scenic.wa.com (Paul Barton-Davis) (09/26/90)

A little gripe/question about the way these are used by most folks. Typical
syntax is:

(require 'foo)
(provide 'bar)

.... (elisp code for new mode etc.)

Although this is almost always OK (most distributed code tends to work
just fine like this), it seems conceptually wrong - 'bar has not yet
been provided at the point claimed. It seems more appropriate to use

(require 'foo)

... (elisp code)

(provide 'bar)

This way, any other packages that (require 'bar) are not corrupted by,
for instance, terminating a load of bar.el, or the occasional error
whilst loading.

Just a thought - what do YOU think ?

Paul Barton-Davis			<pauld@scenic.wa.com>
ScenicSoft, Inc.			
(206) 776-7760
			"Industry without art is brutality"

jbw@bucsf.bu.edu (Joe Wells) (09/30/90)

In article <9009261610.AA01539@scenic.scenic.wa.com> pauld@scenic.wa.com (Paul Barton-Davis) writes:

   ... Typical syntax is:

   (require 'foo)
   (provide 'bar)
   .... (elisp code for new mode etc.)

   Although this is almost always OK (most distributed code tends to work
   just fine like this), it seems conceptually wrong - 'bar has not yet
   been provided at the point claimed. It seems more appropriate to use

   (require 'foo)
   ... (elisp code)
   (provide 'bar)

   This way, any other packages that (require 'bar) are not corrupted by,
   for instance, terminating a load of bar.el, or the occasional error
   whilst loading.

Strangely enough, "provide" and "fset" (ie. "defun") operations are undone
if a failure occurs while loading the definition of an autoloaded
function, but the same is not done for "require".  Hmm.

-- 
Joe Wells <jbw@bu.edu>