unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: John Wiegley <jwiegley@gmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: RE: Should mode commands be idempotent?
Date: Tue, 26 Sep 2017 10:55:28 -0700 (PDT)	[thread overview]
Message-ID: <2564c62e-a419-45d8-809f-433a6f7c3808@default> (raw)
In-Reply-To: <m2zi9ip25y.fsf@newartisans.com>

> FWIW, I can't off the top of my head think of a reason why
> (foo-mode 1) followed by (foo-mode 1) should do something
> different than just calling it once.

Just what do you have in mind, for the meaning here of
"do something different"?  Are we saying that the state
of the Emacs session after the second call should be
identical to the state after the first call?  Just what
kind of "identical" would be meant?

As I said:

  Beyond that, just what kind of "idempotence" is
  in view?  What program state do we expect must be
  identical if a mode is turned on more than once?
  And what do we mean by "identical" here?

  Are we proposing a rule that a mode should not
  establish any state that can be preserved and
  updated each time the mode is turned on?  Or are
  we proposing something much less than that?

  "Idempotence" is a big word.  Just what do folks
  have in mind for it, for the proposed rule?

(No answer to that, except from RMS, who said it
doesn't matter.  In which case the rule doesn't mean
anything either.  Anyone can claim "idempotence" for
any code, for some meaning of "idempotence" or
"identical".  A guideline of "Be idempotent!" with
no explanation is useless.)

Would you argue, for example, that `foo-mode'
should not be allowed to count how many invocations
in a row it has had?  (Why?)

A silly example, perhaps.  The point is that:

1. Such a rule is not needed.  We've all agreed
   that it is _already_ generally respected, in any
   usual sense.  We haven't seen examples of why
   the rule is needed - what we hope to gain by it.

   No one has pointed to an existing mode that is
   _intentionally_ non-idempotent, i.e., that feels
   it needs to do something different for subsequent
   turn-ons.

   The only example given of a mode that does
   something different was `visual-line-mode', where
   it was agreed that the behavior is a bug and is
   not intended or needed for the mode.

2. If such a rule were really needed then we'd need
   to say what we mean by it: just what kinds of
   state change are allowed for subsequent mode
   turn-ons.  Or else we'd need to claim that _no_
   changes are allowed, something that is virtually
   impossible to achieve, let alone verify.

I haven't seen a lot of motivation given for this
purported rule.  But please try putting it into
English, so we can see what's really being proposed.
If it is just something like "Make sure your mode
is idempotent" then see above, both #1 and #2.



  reply	other threads:[~2017-09-26 17:55 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 19:58 Should mode commands be idempotent? Philipp Stephani
2017-09-19 22:10 ` Clément Pit-Claudel
2017-09-19 22:29   ` Stefan Monnier
2017-09-20  7:24     ` Clément Pit-Claudel
2017-09-20 14:52       ` John Wiegley
2017-09-20 22:30         ` Stefan Monnier
2017-09-20 23:05           ` Drew Adams
2017-10-08 15:09         ` Philipp Stephani
2017-09-20 22:25       ` Stefan Monnier
2017-09-23  8:16         ` Clément Pit-Claudel
2017-09-23 14:17           ` Stefan Monnier
2017-09-23 20:37             ` Stefan Monnier
2017-09-19 22:58 ` Drew Adams
2017-09-20  3:10   ` Stefan Monnier
2017-09-20 17:52     ` Drew Adams
2017-09-21  1:11       ` Stefan Monnier
2017-09-21  5:22         ` Drew Adams
2017-09-21 18:28           ` Richard Stallman
     [not found]         ` <<9f11a3c6-b113-4bf6-9dab-f894b2ad77b5@default>
     [not found]           ` <<E1dv6D1-0006Jr-Fl@fencepost.gnu.org>
2017-09-22 15:54             ` Drew Adams
2017-09-23  0:39               ` Richard Stallman
2017-09-23  8:05               ` Clément Pit-Claudel
2017-09-24 17:26                 ` Drew Adams
2017-09-25  7:03                   ` Clément Pit-Claudel
2017-09-25 13:57                     ` Drew Adams
2017-09-26  0:36                       ` Stefan Monnier
2017-09-26  3:30                         ` John Wiegley
2017-09-26 17:55                           ` Drew Adams [this message]
2017-09-26 18:01                             ` John Wiegley
2017-09-26 18:50                               ` Drew Adams
2017-09-26 18:54                                 ` John Wiegley
2017-10-08 15:28                                   ` Philipp Stephani
2017-10-08 19:04                                     ` Stefan Monnier
2017-10-10  2:10                                       ` John Wiegley
2017-12-21 20:49                                       ` Philipp Stephani
2017-12-22  2:20                                         ` Stefan Monnier
2017-10-10 23:15                                   ` Herring, Davis
     [not found]               ` <<E1dvYUB-0007na-Mx@fencepost.gnu.org>
2017-09-24 17:26                 ` Drew Adams
2017-09-25 22:06                   ` Richard Stallman
2017-09-19 23:50 ` John Wiegley
2017-09-20  3:09   ` Stefan Monnier
2017-09-20 13:01 ` 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

  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=2564c62e-a419-45d8-809f-433a6f7c3808@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=jwiegley@gmail.com \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).