From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: when to call provide, first or last? Date: Mon, 27 Feb 2012 08:35:21 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1330349744 11251 80.91.229.3 (27 Feb 2012 13:35:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2012 13:35:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: Le Wang Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 27 14:35:43 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 1S20js-0007WA-8e for ged-emacs-devel@m.gmane.org; Mon, 27 Feb 2012 14:35:40 +0100 Original-Received: from localhost ([::1]:60900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S20jp-0001rp-8u for ged-emacs-devel@m.gmane.org; Mon, 27 Feb 2012 08:35:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S20jh-0001pj-H8 for emacs-devel@gnu.org; Mon, 27 Feb 2012 08:35:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S20jb-00059K-No for emacs-devel@gnu.org; Mon, 27 Feb 2012 08:35:29 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:34087) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S20jb-00059G-JP for emacs-devel@gnu.org; Mon, 27 Feb 2012 08:35:23 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164792632" Original-Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Feb 2012 08:35:22 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 3D3A25922E; Mon, 27 Feb 2012 08:35:21 -0500 (EST) In-Reply-To: (Le Wang's message of "Mon, 27 Feb 2012 20:47:49 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:148814 Archived-At: > What's the accepted idiom for calling (provide 'foo-feature)? I picked up > the habit of calling it first in every library I write. This way two > libraries can call functions from each other without causing a circular > dependency. Actually, such mutual dependencies aren't desirable: sometimes they're hard to avoid so we prefer to live with them, but that doesn't change the fact that they're not good. Putting the provide at the end makes sure that if featurep says t, then it means thatthe feature is actually available, whereas if it's at the beginning, featurep returning t only mean "we've started to lead the feature, and well, maybe we've actually loaded it all by now, but I'm not sure". The difference is sufficiently unimportant to deserve bikeshedding, I guess, but in any case, the convention is to put it at the end. Like every convention, there can be exceptional circumstances that justify doing it differently, but they have to be exceptional rather than only based on taste. Stefan