From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Le Wang Newsgroups: gmane.emacs.devel Subject: Re: when to call provide, first or last? Date: Mon, 27 Feb 2012 21:09:36 +0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d04182662762c5b04b9f1d246 X-Trace: dough.gmane.org 1330348191 31376 80.91.229.3 (27 Feb 2012 13:09:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2012 13:09:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 27 14:09:50 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S20Kn-0001dm-J1 for ged-emacs-devel@m.gmane.org; Mon, 27 Feb 2012 14:09:45 +0100 Original-Received: from localhost ([::1]:40488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S20Kn-0000BR-3U for ged-emacs-devel@m.gmane.org; Mon, 27 Feb 2012 08:09:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S20Kh-0000B8-7E for emacs-devel@gnu.org; Mon, 27 Feb 2012 08:09:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S20Kf-0000iv-R8 for emacs-devel@gnu.org; Mon, 27 Feb 2012 08:09:39 -0500 Original-Received: from mail-wi0-f169.google.com ([209.85.212.169]:52523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S20Kf-0000ik-KW for emacs-devel@gnu.org; Mon, 27 Feb 2012 08:09:37 -0500 Original-Received: by wibhj13 with SMTP id hj13so3708303wib.0 for ; Mon, 27 Feb 2012 05:09:36 -0800 (PST) Received-SPF: pass (google.com: domain of l26wang@gmail.com designates 10.180.86.105 as permitted sender) client-ip=10.180.86.105; Authentication-Results: mr.google.com; spf=pass (google.com: domain of l26wang@gmail.com designates 10.180.86.105 as permitted sender) smtp.mail=l26wang@gmail.com; dkim=pass header.i=l26wang@gmail.com Original-Received: from mr.google.com ([10.180.86.105]) by 10.180.86.105 with SMTP id o9mr28062467wiz.4.1330348176752 (num_hops = 1); Mon, 27 Feb 2012 05:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YtX/xiXMPSv2qZPv3l/XkQVCbw04wMOlElOM8XMBBnc=; b=eR24aTkvGH0WkMPixfglXScCTwgZBmBN294VRnlS4ElZxR+zK0gzuZDa3Yf2DvJwqQ QUW9bKJCAZoGUXb3O9shHmsCSyVvrIkt/Ahcq35pxCoXUV1mnld3BsvNXa/+tbY2izxQ oCjDCF9qeEcwR/Kc/PPhgd1lDG467E6wspH4A= Original-Received: by 10.180.86.105 with SMTP id o9mr22318363wiz.4.1330348176059; Mon, 27 Feb 2012 05:09:36 -0800 (PST) Original-Received: by 10.216.29.130 with HTTP; Mon, 27 Feb 2012 05:09:36 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:148811 Archived-At: --f46d04182662762c5b04b9f1d246 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Feb 27, 2012 at 8:59 PM, Juanma Barranquero wrote: > On Mon, Feb 27, 2012 at 13:47, Le Wang 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 --f46d04182662762c5b04b9f1d246 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Feb 27, 2012 at 8:59 PM, Juanma Barranquero <<= a href=3D"mailto:lekktu@gmail.com">lekktu@gmail.com> wrote:
On Mon, Feb 27, 2012 at 13:47, Le Wang <l26wang@gmail.com> 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 ()
=A0"")
;;; ends here

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

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

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

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

=A0 =A0 Juanma



--
Le
--f46d04182662762c5b04b9f1d246--