unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master de6b1e1efb1: Replace XSETSYMBOL with make_lisp_symbol
@ 2024-02-24 18:23 Eli Zaretskii
  2024-02-24 20:54 ` Mattias Engdegård
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-02-24 18:23 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

Why is this a good idea?  We have those XSET* macros in Emacs since
time immemoriam; why remove them now?



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

* Re: master de6b1e1efb1: Replace XSETSYMBOL with make_lisp_symbol
  2024-02-24 18:23 master de6b1e1efb1: Replace XSETSYMBOL with make_lisp_symbol Eli Zaretskii
@ 2024-02-24 20:54 ` Mattias Engdegård
  2024-02-25  5:53   ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Mattias Engdegård @ 2024-02-24 20:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

24 feb. 2024 kl. 19.23 skrev Eli Zaretskii <eliz@gnu.org>:

> Why is this a good idea?  We have those XSET* macros in Emacs since
> time immemoriam; why remove them now?

There is no longer any reason for having those macros now, nor has there been for a very long time. Several uses of XSETSYMBOL were eliminated in the obarray renovation so this is just me finishing that part of the job. We did the same with XSET_HASH_TABLE and it was a clear improvement.

More in detail, `a=f(b)` is inherently simpler, more transparent, concise and composable than `X(a,b)`. It is obvious to the reader that it's an assignment and that `a` is only modified, `b` not at all and is only evaluated once. There is no need for an assignment at all if the result is used elsewhere.

Another reason for removing remaining uses of the macro is that then the macro itself can be removed, which in turn ensures that no new uses of it will appear.




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

* Re: master de6b1e1efb1: Replace XSETSYMBOL with make_lisp_symbol
  2024-02-24 20:54 ` Mattias Engdegård
@ 2024-02-25  5:53   ` Eli Zaretskii
  2024-03-02 21:57     ` Stefan Monnier via Emacs development discussions.
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-02-25  5:53 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

> From: Mattias Engdegård <mattias.engdegard@gmail.com>
> Date: Sat, 24 Feb 2024 21:54:39 +0100
> Cc: emacs-devel@gnu.org
> 
> 24 feb. 2024 kl. 19.23 skrev Eli Zaretskii <eliz@gnu.org>:
> 
> > Why is this a good idea?  We have those XSET* macros in Emacs since
> > time immemoriam; why remove them now?
> 
> There is no longer any reason for having those macros now, nor has there been for a very long time.

Maybe not for you, but for those like me who are hacking on Emacs for
many years, there is a significant reason: the familiarity with the
Emacs sources and the knowledge of how certain things are done in
Emacs that is burnt into our muscle memory.

> More in detail, `a=f(b)` is inherently simpler, more transparent, concise and composable than `X(a,b)`. It is obvious to the reader that it's an assignment and that `a` is only modified, `b` not at all and is only evaluated once. There is no need for an assignment at all if the result is used elsewhere.

This is your stylistic preference, which I don't share, probably
because I'm biased by many years of staring on Emacs code that uses
such macros everywhere.

So unless you can point out some serious disadvantage of these macros,
I think we should revert that commit, and refrain from doing similar
changes with other XSET* macros we have, at least until the last of us
dinosaurs leave Emacs development.  TIA.



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

* Re: master de6b1e1efb1: Replace XSETSYMBOL with make_lisp_symbol
  2024-02-25  5:53   ` Eli Zaretskii
@ 2024-03-02 21:57     ` Stefan Monnier via Emacs development discussions.
  2024-03-03  6:52       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier via Emacs development discussions. @ 2024-03-02 21:57 UTC (permalink / raw)
  To: emacs-devel

>> More in detail, `a=f(b)` is inherently simpler, more transparent, concise
>> and composable than `X(a,b)`. It is obvious to the reader that it's an
>> assignment and that `a` is only modified, `b` not at all and is only
>> evaluated once. There is no need for an assignment at all if the result is
>> used elsewhere.
>
> This is your stylistic preference, which I don't share, probably
> because I'm biased by many years of staring on Emacs code that uses
> such macros everywhere.

I don't have a strong opinion about whether we should keep the XSETFOO
style of macros, but I've been annoyed several times in the past at the
need to introduce a "tmp" local var just to do

    XSETFOO (tmp, mything);
    ... tmp ...

which can turn from merely inconvenient and ugly to almost impossible
when such code needs to be used in an expression macro, which we can't
really introduce such local variables.  For that reason, I started
using `make_lisp_ptr` and things along these lines.


        Stefan




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

* Re: master de6b1e1efb1: Replace XSETSYMBOL with make_lisp_symbol
  2024-03-02 21:57     ` Stefan Monnier via Emacs development discussions.
@ 2024-03-03  6:52       ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-03-03  6:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> Date: Sat, 02 Mar 2024 16:57:28 -0500
> From:  Stefan Monnier via "Emacs development discussions." <emacs-devel@gnu.org>
> 
> >> More in detail, `a=f(b)` is inherently simpler, more transparent, concise
> >> and composable than `X(a,b)`. It is obvious to the reader that it's an
> >> assignment and that `a` is only modified, `b` not at all and is only
> >> evaluated once. There is no need for an assignment at all if the result is
> >> used elsewhere.
> >
> > This is your stylistic preference, which I don't share, probably
> > because I'm biased by many years of staring on Emacs code that uses
> > such macros everywhere.
> 
> I don't have a strong opinion about whether we should keep the XSETFOO
> style of macros, but I've been annoyed several times in the past at the
> need to introduce a "tmp" local var just to do
> 
>     XSETFOO (tmp, mything);
>     ... tmp ...
> 
> which can turn from merely inconvenient and ugly to almost impossible
> when such code needs to be used in an expression macro, which we can't
> really introduce such local variables.  For that reason, I started
> using `make_lisp_ptr` and things along these lines.

I understand this as a general principle and share it, to a degree.
But it is a weak reason, and so in this case the muscle memory takes
precedence.  I'm still recovering from the
XINT/XFASTINT/XSETINT/XFIXNUM/XFIXNAT change, but in that case it was
at least justified by the addition of bignums.

So I'd like to revert this changeset, and I'm asking everyone to
please not remove the XSET* macros unless we are adding new types or
redesigning the existing ones.



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

end of thread, other threads:[~2024-03-03  6:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-24 18:23 master de6b1e1efb1: Replace XSETSYMBOL with make_lisp_symbol Eli Zaretskii
2024-02-24 20:54 ` Mattias Engdegård
2024-02-25  5:53   ` Eli Zaretskii
2024-03-02 21:57     ` Stefan Monnier via Emacs development discussions.
2024-03-03  6:52       ` Eli Zaretskii

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