all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65555: 29.1; Please un-obsolete buffer-local-value as a generalized variable
@ 2023-08-26 21:09 Adam Porter
  2023-08-31  7:22 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2023-08-26 21:09 UTC (permalink / raw)
  To: 65555

Hi,

In 915efbff9833ea36aeb364e032a639391516912d the BUFFER-LOCAL-VALUE
function's generalized variable forms were marked as obsolete.  The
discussion happened over a few years in bug #26624.  After a delay of
4-5 years, the obsolescence was finally marked in the aforementioned
commit.

I understand that there were some non-obvious side effects in edge
cases.  However, in common cases, the generalized variable form is very
helpful for writing more concise code.  For example:

   (setf (buffer-local-value 'ement-notifications-retro-loading buffer) nil)

...is more concise than:

   (with-current-buffer buffer
     (setq-local ement-notifications-retro-loading nil))

It also expresses its intent more directly, as it's clear that the only
purpose of the form is to set a variable in the buffer rather than
anything else that could happen when the current buffer is changed (i.e.
in context of more code, the benefit is more obvious than in this
minimal example).

As far as I can tell, the objections to the generalized variable
(i.e. the edge cases with non-obvious behavior) were theoretical in
nature, without any concrete problems being noted in real code (that is,
the report was not of a bug encountered in actual use).  In
contrast, in several places in Emacs's own code, forms were rewritten to
be more awkward as a result of this change, without solving any
problems in the changed code.  And as I've noted, there is Elisp outside
of emacs.git that uses (and would like to continue using) this idiom.

As was mentioned in the discussion on #26624, rather than obsoleting the
code and removing a useful feature from Elisp, the rare, non-obvious
behavior related to using CL-LETF could be documented as an
idiosyncrasy, like other rarely encountered rough edges in Elisp.

As well, late last year I asked on emacs-devel that the
mass-obsolescence of several generalized variables be reverted, and I
was asked to individually request specific ones to be un-obsoleted.
<https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01406.html>
I can't say that I will be able to find the time to make such a
comprehensive defense of all the ones I would like to keep using, but
please consider this to be at least one of my responses to that request.

Thanks for your consideration, and your work on Emacs.

Adam





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#65555: 29.1; Please un-obsolete buffer-local-value as a generalized variable
  2023-08-26 21:09 bug#65555: 29.1; Please un-obsolete buffer-local-value as a generalized variable Adam Porter
@ 2023-08-31  7:22 ` Eli Zaretskii
  2023-08-31 17:32   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2023-08-31  7:22 UTC (permalink / raw)
  To: Adam Porter, Stefan Kangas, Stefan Monnier; +Cc: 65555

Stefan and Stefan, any comments to the below?

> Date: Sat, 26 Aug 2023 16:09:33 -0500
> From: Adam Porter <adam@alphapapa.net>
> 
> Hi,
> 
> In 915efbff9833ea36aeb364e032a639391516912d the BUFFER-LOCAL-VALUE
> function's generalized variable forms were marked as obsolete.  The
> discussion happened over a few years in bug #26624.  After a delay of
> 4-5 years, the obsolescence was finally marked in the aforementioned
> commit.
> 
> I understand that there were some non-obvious side effects in edge
> cases.  However, in common cases, the generalized variable form is very
> helpful for writing more concise code.  For example:
> 
>    (setf (buffer-local-value 'ement-notifications-retro-loading buffer) nil)
> 
> ...is more concise than:
> 
>    (with-current-buffer buffer
>      (setq-local ement-notifications-retro-loading nil))
> 
> It also expresses its intent more directly, as it's clear that the only
> purpose of the form is to set a variable in the buffer rather than
> anything else that could happen when the current buffer is changed (i.e.
> in context of more code, the benefit is more obvious than in this
> minimal example).
> 
> As far as I can tell, the objections to the generalized variable
> (i.e. the edge cases with non-obvious behavior) were theoretical in
> nature, without any concrete problems being noted in real code (that is,
> the report was not of a bug encountered in actual use).  In
> contrast, in several places in Emacs's own code, forms were rewritten to
> be more awkward as a result of this change, without solving any
> problems in the changed code.  And as I've noted, there is Elisp outside
> of emacs.git that uses (and would like to continue using) this idiom.
> 
> As was mentioned in the discussion on #26624, rather than obsoleting the
> code and removing a useful feature from Elisp, the rare, non-obvious
> behavior related to using CL-LETF could be documented as an
> idiosyncrasy, like other rarely encountered rough edges in Elisp.
> 
> As well, late last year I asked on emacs-devel that the
> mass-obsolescence of several generalized variables be reverted, and I
> was asked to individually request specific ones to be un-obsoleted.
> <https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01406.html>
> I can't say that I will be able to find the time to make such a
> comprehensive defense of all the ones I would like to keep using, but
> please consider this to be at least one of my responses to that request.
> 
> Thanks for your consideration, and your work on Emacs.
> 
> Adam
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#65555: 29.1; Please un-obsolete buffer-local-value as a generalized variable
  2023-08-31  7:22 ` Eli Zaretskii
@ 2023-08-31 17:32   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31 19:27     ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-31 17:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Adam Porter, Stefan Kangas, 65555

I'm OK with un0obsoleting it.
`cl-letf` is a source of problems for many generalized variables, and
maybe the better answer would be to allow generalized vars to provide
specific support for `cl-letf` (such as declare themselves as being
incompatible with it ;-).


        Stefan






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#65555: 29.1; Please un-obsolete buffer-local-value as a generalized variable
  2023-08-31 17:32   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-31 19:27     ` Stefan Kangas
  2023-09-02  7:46       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2023-08-31 19:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Adam Porter, Eli Zaretskii, 65555

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I'm OK with un0obsoleting it.

Fine with me too.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#65555: 29.1; Please un-obsolete buffer-local-value as a generalized variable
  2023-08-31 19:27     ` Stefan Kangas
@ 2023-09-02  7:46       ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-09-02  7:46 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: adam, monnier, 65555-done

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Thu, 31 Aug 2023 21:27:41 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, Adam Porter <adam@alphapapa.net>, 65555@debbugs.gnu.org
> 
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
> > I'm OK with un0obsoleting it.
> 
> Fine with me too.

Done one the emacs-29 branch, and closing the bug.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-02  7:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-26 21:09 bug#65555: 29.1; Please un-obsolete buffer-local-value as a generalized variable Adam Porter
2023-08-31  7:22 ` Eli Zaretskii
2023-08-31 17:32   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-31 19:27     ` Stefan Kangas
2023-09-02  7:46       ` Eli Zaretskii

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.