From: Drew Adams <drew.adams@oracle.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 15122@debbugs.gnu.org
Subject: bug#15122: 24.3.50; [PATCH] byte-compiler warnings about destructive functions
Date: Sun, 18 Aug 2013 22:07:14 -0700 (PDT) [thread overview]
Message-ID: <189c1f04-03cf-4dbb-b8ac-b190a774788c@default> (raw)
In-Reply-To: <jwvbo4us80h.fsf-monnier+emacs@gnu.org>
> > This StackOverflow entry suggested that the Emacs-Lisp byte compiler be
> > able to warn about the use of functions that are destructive, i.e., can
> > modify data structures in place:
> > http://stackoverflow.com/questions/17610046/elisp-destructive-operation-
> > warning Attached is a patch that provides this, at least a start.
>
> All of those functions are used on a regular basis in perfectly
> correct code. So just flagging every call is not going to fly. We need
> to have some further analysis so that we don't flag all calls, but only
> those that "could be dangerous".
>
> As it stands, your code would just flood you with false positives,
> so it wouldn't really help you find the problematic uses.
That was not the aim. The question was not whether particular code that
uses a destructive operation is correct. The question was whether
particular code uses a destructive operation at all. That's all.
See the OP, which spoke of an "elisp-newbie-mode". He requested a
feature that "adds warnings about destructive operations being used".
Not being used wrongly or problematically, just being used.
Anyway, I would agree that warning about use of a destructive function
should be turned off by default. It's also fine with me if you ignore
the patch altogether.
I can see a use for such a warning, as I expect there are a fair number
of people who want to avoid using destructive operations in general and
might not be aware of when they might be doing so. I mentioned Scheme's
explicit choice to name all such functions in a noticeable way. Drawing
attention to (all) use of destructive operations is not necessarily a
useless thing, depending on the user and context.
That was the point of the patch. It was not to detect uses that are
"problematic", such as where you forget to use `setq' after `delq' to
store the result back into the source variable, or similar. (Yes, it
is true that the OP example was such a case.)
next prev parent reply other threads:[~2013-08-19 5:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-18 5:26 bug#15122: 24.3.50; [PATCH] byte-compiler warnings about destructive functions Drew Adams
2013-08-18 18:38 ` Richard Stallman
2013-08-19 2:59 ` Stefan Monnier
2013-08-19 5:07 ` Drew Adams [this message]
2013-08-20 5:07 ` Stefan Monnier
2013-08-20 14:07 ` Drew Adams
2013-08-20 14:39 ` Stefan Monnier
2013-08-20 15:15 ` Drew Adams
2013-08-21 1:00 ` Leo Liu
2013-08-21 4:24 ` Stefan Monnier
2013-08-21 16:54 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=189c1f04-03cf-4dbb-b8ac-b190a774788c@default \
--to=drew.adams@oracle.com \
--cc=15122@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.