emacs-devel
[Top][All Lists]
Advanced

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

Re: package.el: soft dependencies?


From: Tassilo Horn
Subject: Re: package.el: soft dependencies?
Date: Thu, 16 Jul 2015 14:23:55 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Artur Malabarba <address@hidden> 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



reply via email to

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