all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <moasen@zoho.com>
To: help-gnu-emacs@gnu.org
Subject: Re: eval-when-compile and require
Date: Tue, 21 Nov 2017 17:55:34 +0100	[thread overview]
Message-ID: <86fu97wozd.fsf@zoho.com> (raw)
In-Reply-To: 20171121072913.GA11830@tuxteam.de

t wrote:

> You use this when you require foo's services
> at compile time.
>
> The most common case would be that you
> require macro definitions from foo: there,
> (require 'foo) would arrive too late.
> The compiler is the one which has to expand
> the macros, so their definitions are needed
> during the compile phase.

Actually that is quite common with all the
CL macros. And I've never had any warnings or
problem with those.

One example is

    cl-incf is a Lisp macro in `cl-lib.el'.

Here is another situation

    cl-caddr is a compiled Lisp function in
    `cl-lib.el'.

    (cl-caddr X)

    This function has a compiler macro
    `cl--compiler-macro-cXXr'.

What does it mean the "function has a compiler
macro"?

> Another example would be to do some
> pre-calculation you don't want to repeat at
> run time (because it takes too long, or
> because you want to make sure that its
> results stay stable)

OK, not familiar with that situation...

> Note that when you need something *both* at
> compile and at run time, eval-and-compile is
> your friend.

Likewise...

>> Here I'm not following. Of course the stuff
>> should be compiled. And if it isn't, the
>> above enclosement with `eval-when-compile'
>> helps by... breaking it?
>
> Hm. What gets broken?

With `eval-when-compile', if it does what it
says, and without compilation, won't the
definitions be void with the `require'
never being reached?

>> Besides there are no warnings with plain
>> `require', so what does it all mean?
>
> Then you don't seem to need whatever foo
> provides at compile time => you only need
> a plain "require".

Well, sometimes not even that!
Possible explanation interference from other
files being compiled, or being in a compiled
state, that are required from the file...

-- 
underground experts united
http://user.it.uu.se/~embe8573




  reply	other threads:[~2017-11-21 16:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21  4:05 eval-when-compile and require Emanuel Berg
2017-11-21  7:29 ` tomas
2017-11-21 16:55   ` Emanuel Berg [this message]
2017-11-22  2:42 ` Stefan Monnier
2017-11-22 14:03   ` Emanuel Berg
2017-11-23  5:25   ` Emanuel Berg
2017-11-27  2:51   ` Emanuel Berg
     [not found] ` <mailman.4288.1511318543.27995.help-gnu-emacs@gnu.org>
2017-11-23  5:22   ` Emanuel Berg

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=86fu97wozd.fsf@zoho.com \
    --to=moasen@zoho.com \
    --cc=help-gnu-emacs@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 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.