unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-devel@gnu.org
Subject: Re: eval-when-compile
Date: Wed, 08 Aug 2012 20:51:18 +0200	[thread overview]
Message-ID: <87a9y5w72x.fsf@Rainer.invalid> (raw)
In-Reply-To: CAJsNXTnDRi91rDySQjxfFqDtCz3iqd8wGx0rheBei=eM_zB8og@mail.gmail.com

PJ Weisberg writes:
> You know what you could do?
>
> ---
> (eval
>  (eval-when-compile
>    (if nil
>        '(defvar quoted-t "true")
>      '(defvar quoted-nil "false")))
> ---
>
> That'll compile to:
>
> ---
> (eval
>  '(defvar quoted-nil "false"))
> ---

Thanks.  I tried this and actually it compiles to just

(defvar quoted-nil "false")

as I expected my first variant to do.  I am not sure what the outer eval
is doing, though: it doesn't look like it is executed at compile-time,
so it must somehow be optimized away by the byte-compiler (some rule
that "(eval (quote <…>))" is identical to "<…>", perhaps?).


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




  reply	other threads:[~2012-08-08 18:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27  5:01 eval-when-compile Achim Gratz
2012-07-27  6:26 ` eval-when-compile Pascal J. Bourguignon
2012-07-27  7:41   ` eval-when-compile PJ Weisberg
2012-07-27  8:11     ` eval-when-compile Pascal J. Bourguignon
2012-07-27 17:50   ` eval-when-compile Achim Gratz
2012-07-28  0:52     ` eval-when-compile Stephen J. Turnbull
2012-07-28  6:01       ` eval-when-compile Achim Gratz
2012-07-28 18:04     ` eval-when-compile PJ Weisberg
2012-08-08 18:51       ` Achim Gratz [this message]
2012-08-08 21:13 ` eval-when-compile Johan Bockgård

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=87a9y5w72x.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=emacs-devel@gnu.org \
    /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).