help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Byte-compiler warnings


From: Stefan Monnier
Subject: Re: Byte-compiler warnings
Date: Wed, 24 Jun 2015 23:06:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> One question is: if (goto-char (point-min)) is
> equivalent, why cannot the byte-compiler just use that
> instead for the compiled version?

In general such "use <foo> instead" messages are used instead of doing
the rewrite silently for two reasons:
1- the two aren't actually equivalent.  The provide the same feature but
   in different ways or with different corner case behavior, so the compiler
   can't safely replace one for the other.  E.g. beginning-of-buffer
   sets the mark; which is the reason why it's usually not what you want
   from Elisp, but the compiler can't know if that's actually what you want.
2- the two are equivalent, but one is deprecated so we want people to
   fix the source code.  This might be also because the compiler can
   detect and optimize some cases but not all, so it's important to tell
   the programmer that these forms are deprecated so she can hopefully
   stop using them also in those places that the byte-compiler can't
   detect (e.g. '(lambda ...) vs #'(lambda ...) which then compiler can
   detect when passed to `apply' or `mapcar' but not in general since in
   general '(lambda ...) might just be a list rather than a function).


        Stefan


reply via email to

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