all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Byte compiler and eval-when-compile
Date: Mon, 15 Oct 2012 20:58:27 -0400	[thread overview]
Message-ID: <jwvehkzz15p.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87626b7d02.fsf@engster.org> (David Engster's message of "Mon, 15 Oct 2012 21:26:37 +0200")

>> Actually, it just recovered the smartness I added many years ago and
>> which got broken years ago as well.
> Just to make sure I understand this right: the byte-compiler will now
> bark if you're using functions (instead of just macros and defsubsts)
> from eval-when-compile'd required packages?

Yes, at least that's the intention: IIRC the implementation is pretty
approximate, so it may very well miss some such functions and complain
about unjustified ones.

>> If you both do the (eval-when-compile (require 'eldoc)) and the
>> `require', the byte-compiler could be smarter indeed: when it sees the
>> inner `require' call, it could check load-history and mark all functions
>> defined therein as being fine for the current scope.
> Well, that would be more or less a legalization of the little hack I did
> so far.

Your hack so far was not and isn't illegal.  It's simply not understood
by the byte-compiler, currently.

>> A simpler solution might be to provide a new (funcall-require PACKAGE
>> FUNCTION &rest ARGS), so you'd do
>> (funcall-require 'eldoc #'eldoc-function-argstring '("foo" "bar"))
>> but the compiler could still be taught to check that
>> eldoc-function-argstring indeed exists in eldoc and accepts being called
>> with a single argument.
> That's pretty much a combination of declare-function and require, isn't
> it?

It's a combination of require, declare-function, and funcall, so I think
it does save typing.


        Stefan



  reply	other threads:[~2012-10-16  0:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 16:23 Byte compiler and eval-when-compile David Engster
2012-10-15 18:41 ` Stefan Monnier
2012-10-15 19:26   ` David Engster
2012-10-16  0:58     ` Stefan Monnier [this message]
2012-10-18 18:55       ` David Engster
2012-10-18 19:53         ` Glenn Morris
2012-10-18 20:07           ` David Engster
2012-10-18 20:11           ` Glenn Morris
2012-10-18 20:15             ` David Engster
2012-10-19  0:38         ` Stefan Monnier

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=jwvehkzz15p.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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 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.