emacs-devel
[Top][All Lists]
Advanced

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

Re: when to call provide, first or last?


From: Le Wang
Subject: Re: when to call provide, first or last?
Date: Mon, 27 Feb 2012 21:09:36 +0800

On Mon, Feb 27, 2012 at 8:59 PM, Juanma Barranquero <address@hidden> wrote:
On Mon, Feb 27, 2012 at 13:47, Le Wang <address@hidden> wrote:

> Is there some disadvantage to calling it first that I'm not seeing?

Try loading this file my-feature.el:

;;; starts here
(provide 'my-feature)
)
(defun my-function ()
 "")
;;; ends here

with  emacs -Q -l my-feature.el, and you'll get:

load-with-code-conversion: Invalid read syntax: ")"

(featurep 'my-feature) => t
(fboundp 'my-function) => nil

What happens next?  You have broken code, and you're either looking at the backtrace or you get a ding.  How is this a problem?
 
In other words, having `provide' at the end guarantees that the
feature does not enter the feature list unless the file was correctly
loaded.

    Juanma



--
Le

reply via email to

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