[Top][All Lists]

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

RE: Should mode commands be idempotent?

From: Drew Adams
Subject: RE: Should mode commands be idempotent?
Date: Tue, 19 Sep 2017 15:58:23 -0700 (PDT)

> I think it's generally expected that mode commands (both major and
> minor) are reasonably idempotent, i.e. calling them twice should
> have the same effects as calling them once (unless using 'toggle,
> of course).  However, I couldn't find this requirement in the manual,
> should it be added to the "Modes" section?

It is perhaps typical; i.e., perhaps most modes have that
property.  But I don't see why it "should" be true of modes.
Why should it be a "requirement" or a convention?

People can use a mode for whatever they want.  A mode can
do anything its author wants it to do.  I see that as a
good thing, not a bad thing.

What's the use case for such a restriction?  If it's to
allow for easier program analysis or something, it should
be enough to let people know (if appropriate) that if a
mode is not idempotent then it might be more difficult to
reason about its behavior.  (But reasoning about Lisp
behavior is anyway not something simple - Lisp is not

The fact that most modes are likely idempotent should be
enough, I think.  Most mode writers don't go out of their
way to make a mode act differently if it is turned on more
than once.

reply via email to

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