[Top][All Lists]

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

Re: cc-vars.el

From: Stefan Monnier
Subject: Re: cc-vars.el
Date: Wed, 20 Nov 2002 08:58:54 -0500

> Martin Stjernholm <address@hidden> writes:
> > > /.../  A few extra fboundp checks at load-time are so utterly
> > > inconsequential that it's hardly worth worrying about the possibility that
> > > they might be generated in some cases.
> > 
> > What makes you think they are restricted to load time code?
> The idioms I'm thinking of are:
>   (if (fboundp 'foo)
>       (foo bar)
>     (foo-work-around bar))
> which will work for `when' too, due to macroexpansion:
>   (when (fboundp 'foo)
>     ...do stuff...
>     (foo bar)
>     ...do more stuff...)
> I'd probably make it work for `and' too, so you could do:
>   (and (fboundp 'foo) (foo bar))
> What case do you have in mind where these aren't sufficient?
> Can you give examples?

Obviously your example are in run-time code, not in load-time code,
so you seem to agree with him that the fboundp checks will not just occur
at load-time.

> > What would be the problem of adding a macro in the bytecomp
> > environment to control the warning aspect only?  That has to be
> > simpler than recognizing the if-form.  It's not like it's an either-or
> > issue between two irreconcilable solutions.
> No, but let's not add both unless it's actually necessary.

There's already a macro to turn off warnings for variables: (defvar foo).
I suggested to do the same for (defun bar), but IIRC Richard vetoed it
because he thinks pragmas to turn off some warnings are just wrong.

The fact is that people do want them and end up cobbling up hackish
ones (as we've seen with cc-bytecomp; I myself used something like
(eval-when-compile (autoload 'foo "bar")), so we might as well provide
clean ones.  This way we could even add an "ignore pragmas" flag for
people who like to get all the warnings.

As for whether or not pragmas will ever be made unnecessary, my opinion
is that it seems highly unlikely that we'll ever get the byte-compiler
to understand all the cases where a function call is safe.

But I also completely agree that we should try to make sure that pragmas
as needed as rarely as possible, so I wholeheartedly support Dave's
suggestion which will at least reduce the amount of useless warnings.


reply via email to

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