[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Byte compiler and eval-when-compile
From: |
Stefan Monnier |
Subject: |
Re: Byte compiler and eval-when-compile |
Date: |
Mon, 15 Oct 2012 20:58:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
>> 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
- Byte compiler and eval-when-compile, David Engster, 2012/10/15
- Re: Byte compiler and eval-when-compile, Stefan Monnier, 2012/10/15
- Re: Byte compiler and eval-when-compile, David Engster, 2012/10/15
- Re: Byte compiler and eval-when-compile,
Stefan Monnier <=
- Re: Byte compiler and eval-when-compile, David Engster, 2012/10/18
- Re: Byte compiler and eval-when-compile, Glenn Morris, 2012/10/18
- Re: Byte compiler and eval-when-compile, David Engster, 2012/10/18
- Re: Byte compiler and eval-when-compile, Glenn Morris, 2012/10/18
- Re: Byte compiler and eval-when-compile, David Engster, 2012/10/18
- Re: Byte compiler and eval-when-compile, Stefan Monnier, 2012/10/18