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-letwithineval-and-compilehave compared to the bare version w.r.t. interpretation/byte-compilation/macroexpansion, etc. - I roughly understand by looking at the definition of
defunthat 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 betweendefaliasanddefun, e.g. different treatment by the byte-compiler?