From: Tassilo Horn <tsdh@gnu.org>
To: Artur Malabarba <bruce.connor.am@gmail.com>
Cc: Yuri D'Elia <wavexx@thregr.org>,
Stefan Monnier <monnier@iro.umontreal.ca>,
Bozhidar Batsov <bozhidar@batsov.com>,
emacs-devel <emacs-devel@gnu.org>
Subject: Re: package.el: soft dependencies?
Date: Thu, 16 Jul 2015 14:23:55 +0200 [thread overview]
Message-ID: <87lheg47fo.fsf@gnu.org> (raw)
In-Reply-To: <CAAdUY-JfG80MA6Chx8hLOn1Ozjr1MHUpX9+nK+GDcK2Avu8Ujw@mail.gmail.com> (Artur Malabarba's message of "Thu, 16 Jul 2015 12:35:32 +0100")
Artur Malabarba <bruce.connor.am@gmail.com> 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
prev parent reply other threads:[~2015-07-16 12:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-14 20:53 package.el: soft dependencies? Yuri D'Elia
2015-07-14 21:28 ` Rasmus
2015-07-14 21:52 ` Yuri D'Elia
2015-07-14 22:03 ` Yuri D'Elia
2015-07-15 10:06 ` Artur Malabarba
2015-07-15 15:09 ` Bozhidar Batsov
2015-07-14 23:32 ` Stefan Monnier
2015-07-16 11:35 ` Artur Malabarba
2015-07-16 12:23 ` Tassilo Horn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lheg47fo.fsf@gnu.org \
--to=tsdh@gnu.org \
--cc=bozhidar@batsov.com \
--cc=bruce.connor.am@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=wavexx@thregr.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.