The byte-compiler does not currently seem to recognise that a function has been defined when using defun
within a let
expression under lexical-binding
, as explained in Stefan's answer to this question.
In my own initialisation file, I have found that I can make the defun
-within-let
obvious to the byte-compiler by wrapping the whole form in eval-and-compile
, as I noted under the same question.
My multipart question is:
- What further effects (desirable or otherwise) does placing the
defun
-within-let
withineval-and-compile
have compared to the bare version w.r.t. interpretation/byte-compilation/macroexpansion, etc. - I roughly understand by looking at the definition of
defun
that it is a glorified wrapper arounddefalias
. Apart from forgoing the explicit(lambda () ...)
(or other function value) which needs to be passed todefalias
, is there some other subtle difference betweendefalias
anddefun
, e.g. different treatment by the byte-compiler?
C-s top-level
in the manual to see more. A top-level sexp is just a sexp that is not enclosed in another sexp within a file or buffer (or perhaps some other scope of discourse).progn
) might still be considered "top-level" in some capacity, e.g. in the context of byte-compiler declarations, macro calls, etc.