From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: tramp-compat-funcall -> compat-funcall?
Date: Thu, 22 Sep 2016 08:31:22 -0400 [thread overview]
Message-ID: <jwveg4cdsv2.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 87lgykci0z.fsf@lifelogs.com
> ;; For not existing functions, obsolete functions, or functions with a
> ;; changed argument list, there are compiler warnings. We want to
> ;; avoid them in cases we know what we do.
> (defmacro tramp-compat-funcall (function &rest arguments)
> "Call FUNCTION if it exists. Do not raise compiler warnings."
> `(when (or (subrp ,function) (functionp ,function))
> (with-no-warnings (funcall ,function ,@arguments))))
[ The `subrp' check looks wrong/redundant. `functionp' should already return
non-nil if `function` is a subr (unless it's a special form, in which
case using `funcall` would be wrong anyway). ]
FWIW, using tramp-compat-funcall "for not existing functions" is a bad
idea: better use (if (fboundp <foo>) (<foo> ...)).
I think the same kind of consideration should hold for the other two
cases, tho maybe currently the byte-compiler does not offer/detect any
syntax for that.
I think hiding this behind (tramp-)compat-funcall would be better
avoided (just like using with-no-warnings should be avoided whenever
possible).
IOW, if there's a kind of situation that recurs often enough to warrant
something like (tramp-)compat-funcall you should report this as a bug.
Stefan
next prev parent reply other threads:[~2016-09-22 12:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 11:04 tramp-compat-funcall -> compat-funcall? Ted Zlatanov
2016-09-22 12:31 ` Stefan Monnier [this message]
2016-09-22 13:22 ` Michael Albinus
2016-09-22 17:46 ` Stefan Monnier
2016-09-22 17:54 ` Michael Albinus
2016-09-22 18:23 ` Stefan Monnier
2016-09-22 20:18 ` Ted Zlatanov
2016-09-23 15:49 ` Stefan Monnier
2016-09-24 6:54 ` Michael Albinus
2016-09-24 13:57 ` Stefan Monnier
2016-09-24 15:39 ` Michael Albinus
2016-09-24 18:40 ` Stefan Monnier
2016-09-25 11:44 ` Michael Albinus
2016-09-25 14:00 ` Stefan Monnier
2016-09-25 17:23 ` Ted Zlatanov
2016-09-24 22:42 ` Ted Zlatanov
2016-09-25 14:17 ` Stefan Monnier
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=jwveg4cdsv2.fsf-monnier+gmane.emacs.devel@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.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.