From: "Drew Adams" <drew.adams@oracle.com>
Subject: Are nested defun's byte-compiled?
Date: Sun, 15 May 2005 15:47:51 -0700 [thread overview]
Message-ID: <MEEKKIABFKKDFJMPIOEBEEPICKAA.drew.adams@oracle.com> (raw)
Is the code defining a nested defun byte-compiled when its enclosing defun
is compiled? Example source file foo.el:
(defcustom define-bar-flag t "Define `bar' if non-nil.")
(defun foo ()
"Do foo stuff. Define `bar' if `define-bar-flag' is non-nil."
(when define-bar-flag (defun bar () (bar-stuff)))
(rest-of-foo-stuff))
Suppose foo.el is byte-compiled, and then foo.elc is loaded.
Is `define-bar-flag' eval'd when compiling foo? I assume not. I assume that
`bar' is not defined if `define-bar-flag' was set to nil before foo.elc is
loaded. I assume that `bar' is not defined until `(foo)' is executed, and
then only if `define-bar-flag' is non-nil.
When foo.el was byte-compiled, is bar's potential definition (the defun
itself) also byte-compiled or not? That is, if `(foo)' is executed after
loading foo.elc, which version of `bar' is defined, byte-compiled or not?
If the answer is that the non-compiled version of `bar' is defined, how can
the code be changed to make the compiled version be defined instead? Is this
a good way to do that?
(defun foo ()
(when define-bar-flag (byte-compile (defun bar () (bar-stuff))))
(rest-of-foo-stuff))
next reply other threads:[~2005-05-15 22:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-15 22:47 Drew Adams [this message]
2005-05-24 17:46 ` Are nested defun's byte-compiled? Drew Adams
[not found] <mailman.52.1116355611.25862.help-gnu-emacs@gnu.org>
2005-05-20 14:59 ` Stefan Monnier
[not found] <mailman.1588.1116958704.25862.help-gnu-emacs@gnu.org>
2005-05-24 22:15 ` Thierry Emery
2005-05-24 22:25 ` Drew Adams
2005-05-25 15:53 ` Stefan Monnier
2005-05-25 16:23 ` Drew Adams
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=MEEKKIABFKKDFJMPIOEBEEPICKAA.drew.adams@oracle.com \
--to=drew.adams@oracle.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 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.