From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: package.el: soft dependencies? Date: Thu, 16 Jul 2015 14:23:55 +0200 Message-ID: <87lheg47fo.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1437049468 27482 80.91.229.3 (16 Jul 2015 12:24:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Jul 2015 12:24:28 +0000 (UTC) Cc: Yuri D'Elia , Stefan Monnier , Bozhidar Batsov , emacs-devel To: Artur Malabarba Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 16 14:24:19 2015 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 1ZFiD4-0006BH-U2 for ged-emacs-devel@m.gmane.org; Thu, 16 Jul 2015 14:24:19 +0200 Original-Received: from localhost ([::1]:39977 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFiD4-00037i-3C for ged-emacs-devel@m.gmane.org; Thu, 16 Jul 2015 08:24:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFiCp-00037L-EZ for emacs-devel@gnu.org; Thu, 16 Jul 2015 08:24:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFiCk-0008Oo-6V for emacs-devel@gnu.org; Thu, 16 Jul 2015 08:24:03 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:54928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFiCk-0008Og-0c for emacs-devel@gnu.org; Thu, 16 Jul 2015 08:23:58 -0400 Original-Received: from thinkpad-t440p (dhcp67.uni-koblenz.de [141.26.71.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 5C0111A8346; Thu, 16 Jul 2015 14:23:56 +0200 (CEST) Mail-Followup-To: Artur Malabarba , Stefan Monnier , Yuri D'Elia , Bozhidar Batsov , emacs-devel In-Reply-To: (Artur Malabarba's message of "Thu, 16 Jul 2015 12:35:32 +0100") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 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:187899 Archived-At: Artur Malabarba writes: > If package.el is going to do this, it might be good to add support for > optional dependencies in other places too, like in the byte-compiler. > > For instance, we could have a form like the following > > (require-optionally 'projectile > (projectile-ag projectile-dired ...)) > > When the byte-compiler reads this, it will try to require projectile. > If projectile is available, great, if it isn't then the compiler > treats all those listed functions and macros as `ignore'. > > This would sometimes make it more convenient for the developer to > support optional features, because you would only need to account for > the possibility of them return nil, instead of always being forced to > check if they're `fbound'. Though sometimes you'd still need to check > to manually. IMHO, something like (if (fboundp 'projectile-something) (projectile-something arg) (some-fallback arg)) is much more obvious to be identified as a call to something optional rather than (or (projectile-something arg) (some-fallback arg)) Well, and in the case where nil is a valid return value you couldn't differentiate at all, e.g., with (projectile-project-buffer-p (current-buffer) root) you the current buffer could either be no project buffer under root or projectile could simply not be available. Bye, Tassilo