unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Byte-compiler warnings
Date: Wed, 24 Jun 2015 23:06:40 -0400	[thread overview]
Message-ID: <jwvk2usv6k7.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.5606.1435189903.904.help-gnu-emacs@gnu.org

> 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


  parent reply	other threads:[~2015-06-25  3:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  9:29 Byte-compiler warnings Marcin Borkowski
2015-06-24 23:50 ` Emanuel Berg
2015-06-25 12:56   ` Nicolas Richard
     [not found] ` <mailman.5606.1435189903.904.help-gnu-emacs@gnu.org>
2015-06-25  3:06   ` Stefan Monnier [this message]
     [not found] <mailman.5561.1435138202.904.help-gnu-emacs@gnu.org>
2015-06-24 11:27 ` Pascal J. Bourguignon
2015-06-25  1:52   ` Emanuel Berg
2015-06-25  2:30     ` Emanuel Berg
2015-06-25  3:19   ` Stefan Monnier
2015-06-25  3:42     ` Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2010-09-12 18:12 byte-compiler warnings Joost Kremers

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvk2usv6k7.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).