unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Phil Sainty <psainty@orcon.net.nz>,
	52290@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#52290: 28.0.90; Undocumented generalized variables
Date: Sun, 05 Dec 2021 21:43:56 +0100	[thread overview]
Message-ID: <87o85uok8j.fsf@gnus.org> (raw)
In-Reply-To: <878rwzauwn.fsf@web.de> (Michael Heerdegen's message of "Sun, 05 Dec 2021 17:17:12 +0100")

Michael Heerdegen <michael_heerdegen@web.de> writes:

> I would want to limit this to the kind of side effect: is it undoubtedly
> clear what it is, is there a "canonical" side effect?

Nope, I don't think so.

Some time back, somebody wrote a library to make Emacs more
functional-ish, and the main bugaboo was Emacs' buffer concept.  I get
the feeling that many (some) people that haven't encountered it before
are just horrified by it.  "You mean...  you put...  text!!!...  into a
... buffer!!!!...  and then you operate on it!?  WHERE"S MY SMELLING
SALTS"

So the library was like (remove-empty-lines BUF) which returned a new
buffer with the empty lines removed.  (I think.  My brain may be making
that bit up.)

> This is the case e.g. for `buffer-modified-p' to a high degree, but
> not for e.g. `point-max': there are several ways to achieve that
> `point-max' will return a certain value - killing a certain amount of
> text, for example.  Or narrowing.  Narrowing was not the thing that
> came to my mind first.  A setter for it might cause confusion because
> the semantics are not clear, in contrast to `buffer-modified-p', I
> think, where it is quite clear.

Yeah, I think so to.  "Setting" `point-max' could mean so many different
things, but setting `buffer-modified-p' can only mean one thing, I
think.  (And note that `buffer-modified-p' has an (optional) buffer
parameter), so if we go by "a setter should always mention the object
it's setting", we're kinda covered.)

> I mean, Emacs is an editor, so we have more aspects of state than
> variable bindings.  Setting variables can also have other side effects
> than simply changing the variable's binding.  Per se I don't see a
> problem in considering more kinds of state (more than variables) as
> places.  OTOH, `point-max' for example is not really a self-contained
> part of state, it's a value of a computation, a derived value.
>
> The classification result can be a bit subjective and depend on the
> viewing point, of course.

Indeed.  I think `point' is perhaps the debatable tipping, er, point.
`(decf (point))' is pretty hard to misunderstand (as a synonym for
`(backward-char 1)'), but I think even that's too ... obscure.
Probably.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2021-12-05 20:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05  1:25 bug#52290: 28.0.90; Undocumented generalized variables Phil Sainty
2021-12-05  1:35 ` Lars Ingebrigtsen
2021-12-05  1:55   ` Michael Heerdegen
2021-12-05  2:00     ` Lars Ingebrigtsen
2021-12-05  2:25       ` Michael Heerdegen
2021-12-05  2:52         ` Lars Ingebrigtsen
2021-12-05 16:17           ` Michael Heerdegen
2021-12-05 20:43             ` Lars Ingebrigtsen [this message]
2021-12-05  2:09   ` Phil Sainty
2021-12-05  2:46     ` Lars Ingebrigtsen
2022-08-21 22:36       ` Lars Ingebrigtsen
2022-08-23  0:07         ` Michael Heerdegen
2022-08-23 10:41           ` Lars Ingebrigtsen
2022-08-31  2:10             ` Michael Heerdegen
2022-08-31  9:58               ` Lars Ingebrigtsen
2022-10-04 11:58         ` Lars Ingebrigtsen
2021-12-06  4:33 ` 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=87o85uok8j.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=52290@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=psainty@orcon.net.nz \
    /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).