emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eval-when-compile vs defconst


From: Stephen Leake
Subject: Re: eval-when-compile vs defconst
Date: Sun, 12 Nov 2006 09:29:23 -0500
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt)

Richard Stallman <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]