emacs-devel
[Top][All Lists]
Advanced

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

Re: cc-vars.el


From: Martin Stjernholm
Subject: Re: cc-vars.el
Date: 19 Nov 2002 21:35:58 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Dave Love <address@hidden> wrote:

> > An interesting angle is if something like the following can be used
> > (although I'd consider this too a workaround rather than a solution):
> > 
> >     (if (boundp 'fido)
> >         (symbol-value 'fido))
> >     (if (fboundp 'fred)
> >         (funcall 'fred ...))
> > 
> > Someone with insight in the inner workings of the compiler can perhaps
> > advice on how effectively it manages to optimize such things.
> 
> (equal (byte-compile (lambda () (if (fboundp 'fred) (funcall 'fred))))
>        (byte-compile (lambda () (if (fboundp 'fred) (fred)))))
>   => t

So simple. ;) This is a good trick to know, but the same doesn't hold
for variables. Of course, that's no proof that the symbol-value thing
is (measurably) slower. I doubt it is.

There are still warnings that aren't addressed by these tricks,
though: The one about obsolete variables, and the one about incorrect
number of arguments (which cc-bytecomp-defun doesn't solve either).

> I think CL used such a trick, but it's not (now) effective.

What is not effective about it?

> > Anyway, this is besides the point regarding cc-bytecomp, since that
> > one is necessary to keep it working and compiling without warnings on
> > both Emacs and XEmacs.
> 
> I don't see what the real difference is between cc-mode and Gnus in
> this respect, but then I'm not maintaining cc-mode.

I've not investigated Gnus so I don't know either. Perhaps they use
symbol-value and funcall everywhere. Besides, cc-bytecomp also solves
another matter, namely to make it compile cleanly even in the presence
of an earlier version of CC Mode being loaded (another issue that is
irrelevant when it's distributed with Emacs). From the look of it,
Gnus hasn't addressed that at all.





reply via email to

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