unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@member.fsf.org>
Cc: Stephen Leake <stephen_leake@member.fsf.org>, emacs-devel@gnu.org
Subject: Re: eval-when-compile vs defconst
Date: Sun, 12 Nov 2006 09:29:23 -0500	[thread overview]
Message-ID: <uzmaw68n0.fsf@member.fsf.org> (raw)
In-Reply-To: <E1Gj7g0-0000kF-Cq@fencepost.gnu.org> (Richard Stallman's message of "Sun, 12 Nov 2006 00:14:40 -0500")

Richard Stallman <rms@gnu.org> writes:

>     I ran across this construct in ada-mode.el:
>
>     (eval-when-compile
>       (defconst ada-95-string-keywords
> 	'("abstract" "aliased" "protected" "requeue" "tagged" "until")
> 	"List of keywords new in Ada 95.
>     Used to define `ada-*-keywords'."))
>
>     Is there any point to the 'eval-when-compile'? Help for
>     eval-when-compile says;
>
> No, you may as well define that variable in all cases.

Ok, thanks.

Now, how about this form:

(defvar ada-block-start-re
  (eval-when-compile
    (concat "\\<\\(" (regexp-opt '("begin" "declare" "else"
				   "exception" "generic" "loop" "or"
				   "private" "select" ))
	    "\\|\\(\\(limited\\|abstract\\|tagged\\)[ \t\n]+\\)*record\\)\\>"))
  "Regexp for keywords starting Ada blocks.")

Is the `eval-when-compile' useful here? I'm thinking it is.

The help for `defvar' says initvalue is evaluated, but it's not clear
whether that happens at compile time or load time.

-- 
-- Stephe

  reply	other threads:[~2006-11-12 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-11 14:39 eval-when-compile vs defconst Stephen Leake
2006-11-11 17:01 ` Bob Rogers
2006-11-11 17:03   ` Bob Rogers
2006-11-12  5:14 ` Richard Stallman
2006-11-12 14:29   ` Stephen Leake [this message]
2006-11-12 19:06     ` Markus Triska
2006-11-13  9:43     ` Richard Stallman
2006-11-13 18:41       ` Stuart D. Herring
2006-11-13 18:46         ` Markus Triska
2006-11-13 20:18         ` Stefan Monnier
2006-11-14 12:27         ` Richard Stallman

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=uzmaw68n0.fsf@member.fsf.org \
    --to=stephen_leake@member.fsf.org \
    --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).