From: Stefan Monnier <monnier@iro.umontreal.ca>
To: akater <nuclearspace@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Improve detection of local function calls in methods
Date: Fri, 27 Aug 2021 18:59:11 -0400 [thread overview]
Message-ID: <jwveeaeo62k.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <878s0mva4u.fsf@gmail.com> (akater's message of "Fri, 27 Aug 2021 21:41:05 +0000")
> Instead of using unreliale and expensive macroexp--fgrep, we record the
> relevant calls in the macroexpansion, as suggested in the FIXME entry.
Yes, please!
> + (defvar cl-generic--uses-cnm nil
> + ;; It would be better to declare the variable special
> + ;; locally where it's used
> + ;; but there is no support for local special declarations in Elisp.
[ I'm not completely sure what you mean, but (defvar foo) has an effect
limited to the current scope. This said, I don't think it matters
much here, because using a globally declared dynvar is perfectly fine
IMO (the main reason not to use a globally declared dynvar is either
because we really want to keep the global definition unbound or
because we really don't want to give the var a namespace prefix). ]
> - `(cl-flet ((cl-call-next-method ,cnm)
> - (cl-next-method-p ,nmp))
> + `(cl-macrolet ((cl-call-next-method
> + (&rest args)
> + (prog1 `(funcall ,',cnm ,@args)
> + (cl-pushnew
> + ',cnm cl-generic--uses-cnm
> + :test #'eq)))
> + (cl-next-method-p
> + ()
> + (prog1 `(funcall ,',nmp)
> + (cl-pushnew
> + ',nmp cl-generic--uses-cnm
> + :test #'eq))))
Hmm... IIUC this fails to account for the case where
#'cl-call-next-method is passed to a function (the most common case (or
more precisely, the only case I've seen so far) being when it's passed
to `apply`).
Stefan
next prev parent reply other threads:[~2021-08-27 22:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 21:41 [PATCH] Improve detection of local function calls in methods akater
2021-08-27 22:59 ` Stefan Monnier [this message]
2021-08-29 11:25 ` akater
2021-09-02 18:34 ` Stefan Monnier
2021-09-10 6:25 ` akater
2021-09-10 15:49 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwveeaeo62k.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=nuclearspace@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).