[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs-26: `with-eval-after-load' docstring omission
From: |
Stefan Monnier |
Subject: |
Re: emacs-26: `with-eval-after-load' docstring omission |
Date: |
Tue, 27 Feb 2018 15:58:05 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> Isn't that an irrelevant implementation detail? I don't see why it
>> should be documented.
> It is relevant, because the behavior isn't the same as 'eval'-ing
> a quoted form.
Yes, the behavior would be different if we quoted the expression and
passed it to `eval`, but in both cases it's an internal implementation
detail, and the relevant difference is the resulting change in
the semantics.
> But I don't think the documentation should be fixed; instead, I think the
> behavior should be changed :)
I think you're blinded by your current problem.
Try and remember the world of Coq. Think about equivalences like
(defun FUN () EXP)
(with-eval-after-load FILE (FUN))
=
(with-eval-after-load FILE EXP)
which are currently true (to the extent such things can be true in
Elisp where FUN can be redefined, of course) whereas
(defun FUN () EXP)
(eval-after-load FILE '(FUN))
≠
(eval-after-load FILE 'EXP)
[ Well, of course, this equivalence is actually true as well given the
current compiler-macro, but I'm assuming above that we undo this
compiler macro. ]
IOW, the behavior you seem to want is semantically a good bit more messy.
In your case, you do want the quote because you need to delay
macro-expansion, but I think it's cleaner to solve this problem by
*explicitly* using a quote, rather than by relying on the messy
semantics of the macro/function you happen to be using.
E.g. your exact same problem could show up if you used, say,
(add-hook 'flycheck-mode-hook ...)
instead of
(with-eval-after-load ...)
but you wouldn't ask for a change in add-hook to "solve" your problem.
Stefan
Re: emacs-26: `with-eval-after-load' docstring omission, Stefan Monnier, 2018/02/27