unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: Sean Whitton <spwhitton@spwhitton.name>,
	emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: Re: master 48aacbf292 2/2: Make many seldom-used generalized variables obsolete
Date: Mon, 19 Sep 2022 01:10:23 +0200	[thread overview]
Message-ID: <87bkrcqnxc.fsf@bernoul.li> (raw)
In-Reply-To: <877d29hm53.fsf@melete.silentflame.com>

I am a bit surprised Stefan Monnier is fine with these deprecation.
If I remember correctly it was him who added the generalized variables,
and back when he did it, I got the impression that there was more to come.

I never used many of these, so I am generally fine with this change,
just somewhat surprised.  Unintuitive side-effects sounds like a good
reason to deprecate them, on the other hand I don't necessarily agree
that, e.g., (setf (point) n) is not intuitive, once you have wrapped
your head around setf.  But seeing that in the wild never-the-less
felt a bit weird.

> I found this in some code of mine, now generating warnings:
>
>     (if (> (point) (mark))
>         (progn (cl-incf (point)) (cl-decf (mark)))
>       (cl-incf (mark)) (cl-decf (point)))
>
> I guess the replacements would be forward-char and set-mark?  Is there
> anything simpler?

As I understood it the idea behind generalized variables wasn't to use
them mainly with setf, when a perfectly fine, explicit setter function
exists; but to use them in situations like this, with other functions
that understand generalized variables.  Made sense to me when the
feature was introduced.

I guess I am just wondering whether generalized variables are generally
seen as a failed experiment, and if so why exactly.  Or if not, I would
be interested in some guidance on when it is considered good practice to
use them and when not.

(Maybe we are going a bit overboard with the deprecations? Maybe we
should instead focus on documenting potentially surprising effects.
If we can think of reasonable use-cases (such as, IMO, the above) then
maybe we should not deprecate.  But again, I don't actually care that
much, just expressing my surprise and resulting uncertainties.

There is one generalized variable that I would like to see undeprecated
though:

   (setf (buffer-local-value 'var buffer) val)

That made a lot of sense to me.  I don't look forward to having to
wrap some (setq-local var val) with with-current-buffer again.  And it
appears I am not the only one you used buffer-local-value like this; 5%
of the out-tree packages that I have installed use it, and they are not
all authored by me.

     Jonas



  parent reply	other threads:[~2022-09-18 23:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166111278304.2846.13033924580993120733@vcs2.savannah.gnu.org>
     [not found] ` <20220821201303.AD1E6C0088A@vcs2.savannah.gnu.org>
2022-08-25 10:39   ` master 48aacbf292 2/2: Make many seldom-used generalized variables obsolete Basil L. Contovounesios
2022-08-25 12:41     ` Lars Ingebrigtsen
2022-09-10  5:17       ` Ihor Radchenko
2022-09-10  6:45         ` Lars Ingebrigtsen
2022-09-10  7:02           ` Ihor Radchenko
2022-09-10  7:07             ` Lars Ingebrigtsen
2022-09-10 14:25               ` Stefan Monnier
2022-09-11  9:33                 ` Ihor Radchenko
2022-09-10 14:21           ` Stefan Monnier
2022-09-11 17:11   ` Sean Whitton
2022-09-11 17:57     ` Lars Ingebrigtsen
2022-09-18 23:10     ` Jonas Bernoulli [this message]
2022-09-19  6:00       ` Lars Ingebrigtsen
2022-09-19 10:01         ` Jonas Bernoulli
2022-09-19 11:38           ` Augusto Stoffel
2022-09-19 12:22             ` Lars Ingebrigtsen
2022-09-19 12:35               ` Augusto Stoffel
2022-09-19 12:37                 ` Lars Ingebrigtsen
2022-09-19 12:51                   ` Augusto Stoffel
2022-09-19 12:21           ` Lars Ingebrigtsen
2022-09-19 12:46         ` Stefan Monnier
2022-09-19 12:54           ` Po Lu
2022-09-19 13:05             ` Lars Ingebrigtsen
2022-09-19 12:46       ` Stefan Monnier

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=87bkrcqnxc.fsf@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=spwhitton@spwhitton.name \
    /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).