unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Shrinking the C core
@ 2023-08-13 11:20 Gerd Möllmann
  2023-08-13 12:52 ` Ihor Radchenko
  0 siblings, 1 reply; 54+ messages in thread
From: Gerd Möllmann @ 2023-08-13 11:20 UTC (permalink / raw)
  To: emacs-devel

 >> AFAIK, all the Emacs-like implementations mentioned on the
 >> web page run on unmodified CL implementations, so you get
 >> the speed of that CL implementation.
 >
 > Uhm, what's an "unmodified CL implementation"?

The implemention as released by the project or vendor.

 >
 > And what implementations are those, you mean they are not as
 > fast as SBCL?

What the Emacs-alikes support varies.  I haven't checked recently, but I 
know that Lem, for instance, started by only supporting SBCL.  Hemlock 
is part of CMUCL and wasn't portable, hence Portable Hemlock.  There's 
also an Emacs-alike that is part of Lispworks' CL implementation 
(commencial).  And so on.  Please consult the project pages.

For some benchmarks on 10 CL implementations, please see

https://www.cliki.net/performance%20benchmarks

BTW, I get DNS errors when sending mail to you via Gmail. Don't know 
what's happening.

Reporting-MTA: dns; dataswamp.org

Final-Recipient: rfc822; incal@dataswamp.org
Action: failed



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

* Re: Shrinking the C core
  2023-08-13 11:20 Shrinking the C core Gerd Möllmann
@ 2023-08-13 12:52 ` Ihor Radchenko
  2023-08-13 15:53   ` [External] : " Drew Adams
  0 siblings, 1 reply; 54+ messages in thread
From: Ihor Radchenko @ 2023-08-13 12:52 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: emacs-devel

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> BTW, I get DNS errors when sending mail to you via Gmail. Don't know 
> what's happening.

Same for me.



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

* RE: [External] : Re: Shrinking the C core
  2023-08-13 12:52 ` Ihor Radchenko
@ 2023-08-13 15:53   ` Drew Adams
  2023-08-14  2:25     ` Emanuel Berg
  0 siblings, 1 reply; 54+ messages in thread
From: Drew Adams @ 2023-08-13 15:53 UTC (permalink / raw)
  To: Ihor Radchenko, Gerd Möllmann; +Cc: emacs-devel

> > BTW, I get DNS errors when sending mail to you via Gmail. Don't know
> > what's happening.
> 
> Same for me.

Ditto.  And it's been pointed out before...


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

* RE: [External] : Re: Shrinking the C core
  2023-08-13  5:50                   ` tomas
@ 2023-08-13 15:54                     ` Drew Adams
  0 siblings, 0 replies; 54+ messages in thread
From: Drew Adams @ 2023-08-13 15:54 UTC (permalink / raw)
  To: tomas@tuxteam.de, emacs-devel@gnu.org

> Still moving forward is a little wonder,
> and I'm genuinely in awe of Eli's job
>  (although I'm not happy about each and
> every [one] of his decisions, but I think
> that'll happen to everyone...

+1.

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

* Re: [External] : Re: Shrinking the C core
  2023-08-13 15:53   ` [External] : " Drew Adams
@ 2023-08-14  2:25     ` Emanuel Berg
  0 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-08-14  2:25 UTC (permalink / raw)
  To: emacs-devel

Drew Adams wrote:

>>> BTW, I get DNS errors when sending mail to you via Gmail.
>>> Don't know what's happening.
>> 
>> Same for me.
>
> Ditto. And it's been pointed out before ...

Seems reasonable as, in this thread alone, three people have
pointed it out.

No, I get your replies here and mails as well for that matter,
but, admittedly, I was fiddling with DNSSEC the other day, and
maybe I br0ke something. Investigating, but have no idea at
the moment what could have caused it.

-- 
underground experts united
https://dataswamp.org/~incal




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

* RE: [External] : Re: Shrinking the C core
  2023-08-20  6:51                                     ` Emanuel Berg
  2023-08-20  7:14                                       ` Ihor Radchenko
@ 2023-08-20 21:51                                       ` Drew Adams
  1 sibling, 0 replies; 54+ messages in thread
From: Drew Adams @ 2023-08-20 21:51 UTC (permalink / raw)
  To: Emanuel Berg, emacs-devel@gnu.org

> > The discussion about floor started from Alfred using `floor'
> > as an example where CL uses system-dependent optimizations
> > and thus being much faster.
> 
> So the answer to the question, Why is SBCL faster?
> is "optimizations". And the answer to the question, Why don't
> we have those optimizations? is "they are not portable"?

https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node103.html#SECTION001300000000000000000

Common Lisp is a standard.  Different implementations
of it should respect the standard, but the standard
allows for different behaviors to some extent, esp.
wrt performance.  CL has multiple ways of declaring
different levels of optimization, which a given
implementation can support or not.

Particular optimizations are not expected to be
portable.



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

* RE: [External] : Re: Shrinking the C core
  2023-08-21  5:06                                                                             ` Ihor Radchenko
@ 2023-08-21  5:25                                                                               ` Drew Adams
  0 siblings, 0 replies; 54+ messages in thread
From: Drew Adams @ 2023-08-21  5:25 UTC (permalink / raw)
  To: Ihor Radchenko, Po Lu
  Cc: Eli Zaretskii, ams@gnu.org, incal@dataswamp.org,
	emacs-devel@gnu.org

> Mostly because such basic functions are rarely changed.
> Of course, it is not impossible that `car' is changed in future.

Perhaps it will become "electric"...



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

* RE: [External] : Re: Shrinking the C core
  2023-09-08  2:00                     ` Arthur Miller
@ 2023-09-08 15:38                       ` Drew Adams
  2023-09-09 11:55                         ` Arthur Miller
  2023-09-11  0:40                         ` Richard Stallman
  0 siblings, 2 replies; 54+ messages in thread
From: Drew Adams @ 2023-09-08 15:38 UTC (permalink / raw)
  To: Arthur Miller, Alan Mackenzie
  Cc: Richard Stallman, luangruo@yahoo.com, emacs-devel@gnu.org

FWIW, +1 for your mail, Arthur -
pretty much each of the points you made.
___

As one who's used CL (long ago) but is
no expert about it or Elisp or Lisp
generally, I happen to agree about the
usefulness of keyword args _for users_.

I can't really speak to implementation,
compilation, maintenance, etc., all of
which are of course also important.

AFAIK there has never been a real, open,
serious discussion about keyword args
for Elisp.  And (I think) I've always
respected the decision to not bring up
the question.  But I do appreciate it
being at least _presented_, if not put
on the table for outright discussion.

In general, I like that Richard speaks
up and decides, and I generally agree
with his judgments as helmsman.  But on
this one my own experience tells me
something different.

Not that I have any interesting opposing
arguments.  Nor do I want to argue about
this.  But my experience with CL has led
me to appreciate the ease and handiness
of using keyword args.

Argument order, and the need to provide
all args up through the last optional
one you really want to provide, are an
unnecessary burden on human readers of
code.  Writers too, of course, but it's
more important that code be clear for
readers (including writers as readers).

Unnecessary burden.  So Occam asks "Why
then?".  In his role as _implementer_ of
a language Occam might ask "Why bother
with keywords args?"  But in his role as
user I think his question would be "Why
always need to know & respect arg order?"

I also haven't noticed that having named
arguments is detrimental to code that
analyses or generates code.  I have some,
but less, experience with that - maybe
it's something to consider; dunno.
___

That's likely all I'll say about this.
Just one opinion.  Keyword args can be
incredibly useful _for users_.



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

* Re: [External] : Re: Shrinking the C core
  2023-09-08 15:38                       ` [External] : " Drew Adams
@ 2023-09-09 11:55                         ` Arthur Miller
  2023-09-09 12:55                           ` Eli Zaretskii
  2023-09-10  0:09                           ` Drew Adams
  2023-09-11  0:40                         ` Richard Stallman
  1 sibling, 2 replies; 54+ messages in thread
From: Arthur Miller @ 2023-09-09 11:55 UTC (permalink / raw)
  To: Drew Adams
  Cc: Alan Mackenzie, Richard Stallman, luangruo@yahoo.com,
	emacs-devel@gnu.org

Drew Adams <drew.adams@oracle.com> writes:

> FWIW, +1 for your mail, Arthur -
> pretty much each of the points you made.
> ___
>
> As one who's used CL (long ago) but is
> no expert about it or Elisp or Lisp
> generally, I happen to agree about the
> usefulness of keyword args _for users_.

Interestingly, how things can be percieved wrongly over the wire.
I always percieved you as an CL veteran and expert :).

> I can't really speak to implementation,
> compilation, maintenance, etc., all of
> which are of course also important.
>
> AFAIK there has never been a real, open,
> serious discussion about keyword args
> for Elisp.  And (I think) I've always
> respected the decision to not bring up
> the question.  But I do appreciate it
> being at least _presented_, if not put
> on the table for outright discussion.
>
> In general, I like that Richard speaks
> up and decides, and I generally agree
> with his judgments as helmsman.  But on
> this one my own experience tells me
> something different.
>
> Not that I have any interesting opposing
> arguments.  Nor do I want to argue about
> this.  But my experience with CL has led
> me to appreciate the ease and handiness
> of using keyword args.

I really didn't want to argue about keyword arguments either, but
Richard brought them up himself. Like you, and probably everyone else
who is familiar with Richards writing through the years, through his
articles and this very mailing list, I am aware of the elephant in the
room, but honestly, I think his friends, Eli and others, are too kind and
would do Richard more favor if they told him when he is dead wrong and
made him to challenge his own view on some questions from time to
time. This reminded me of John Cleese and Faulty Towers, no idea if you
had that in States, but I think every European here knows which episode
I am thinking of at the moment.

> Argument order, and the need to provide
> all args up through the last optional
> one you really want to provide, are an
> unnecessary burden on human readers of
> code.  Writers too, of course, but it's
> more important that code be clear for
> readers (including writers as readers).
>
> Unnecessary burden.  So Occam asks "Why
> then?".  In his role as _implementer_ of
> a language Occam might ask "Why bother
> with keywords args?"  But in his role as
> user I think his question would be "Why
> always need to know & respect arg order?"
>
> I also haven't noticed that having named
> arguments is detrimental to code that
> analyses or generates code.  I have some,
> but less, experience with that - maybe
> it's something to consider; dunno.
> ___
>
> That's likely all I'll say about this.
> Just one opinion.  Keyword args can be
> incredibly useful _for users_.

Thank you, for wording this so concisely.  You are much better with
words than me. I am not a good writer, not even in my own language, so
mine explanations and arguments are always long and round-about for some
reason.

Best regards



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

* Re: [External] : Re: Shrinking the C core
  2023-09-09 11:55                         ` Arthur Miller
@ 2023-09-09 12:55                           ` Eli Zaretskii
  2023-09-09 13:20                             ` Arthur Miller
  2023-09-10  0:09                           ` Drew Adams
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2023-09-09 12:55 UTC (permalink / raw)
  To: Arthur Miller; +Cc: drew.adams, acm, rms, luangruo, emacs-devel

> From: Arthur Miller <arthur.miller@live.com>
> Cc: Alan Mackenzie <acm@muc.de>,  Richard Stallman <rms@gnu.org>,
>  "luangruo@yahoo.com" <luangruo@yahoo.com>,  "emacs-devel@gnu.org"
>  <emacs-devel@gnu.org>
> Date: Sat, 09 Sep 2023 13:55:46 +0200
> 
> I really didn't want to argue about keyword arguments either, but
> Richard brought them up himself. Like you, and probably everyone else
> who is familiar with Richards writing through the years, through his
> articles and this very mailing list, I am aware of the elephant in the
> room, but honestly, I think his friends, Eli and others, are too kind and
> would do Richard more favor if they told him when he is dead wrong and
> made him to challenge his own view on some questions from time to
> time.

This comes out quite condescending, FYI.  You probably didn't mean
that, but the result is not nice anyway.  One more reason to stop this
dispute about personal stylistic preferences, which was futile from
the get-go.



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

* Re: [External] : Re: Shrinking the C core
  2023-09-09 12:55                           ` Eli Zaretskii
@ 2023-09-09 13:20                             ` Arthur Miller
  0 siblings, 0 replies; 54+ messages in thread
From: Arthur Miller @ 2023-09-09 13:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: drew.adams, acm, rms, luangruo, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Cc: Alan Mackenzie <acm@muc.de>,  Richard Stallman <rms@gnu.org>,
>>  "luangruo@yahoo.com" <luangruo@yahoo.com>,  "emacs-devel@gnu.org"
>>  <emacs-devel@gnu.org>
>> Date: Sat, 09 Sep 2023 13:55:46 +0200
>> 
>> I really didn't want to argue about keyword arguments either, but
>> Richard brought them up himself. Like you, and probably everyone else
>> who is familiar with Richards writing through the years, through his
>> articles and this very mailing list, I am aware of the elephant in the
>> room, but honestly, I think his friends, Eli and others, are too kind and
>> would do Richard more favor if they told him when he is dead wrong and
>> made him to challenge his own view on some questions from time to
>> time.
>
> This comes out quite condescending, FYI.  You probably didn't mean
> that, but the result is not nice anyway.

No, I certainly didn't mean as patronizing if that is what "condecending".

> that, but the result is not nice anyway.  One more reason to stop this
> dispute about personal stylistic preferences, which was futile from
> the get-go.

I agree it is futile.

No problems; thanks for telling me.



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

* RE: [External] : Re: Shrinking the C core
  2023-09-09 11:55                         ` Arthur Miller
  2023-09-09 12:55                           ` Eli Zaretskii
@ 2023-09-10  0:09                           ` Drew Adams
  1 sibling, 0 replies; 54+ messages in thread
From: Drew Adams @ 2023-09-10  0:09 UTC (permalink / raw)
  To: Arthur Miller
  Cc: Alan Mackenzie, Richard Stallman, luangruo@yahoo.com,
	emacs-devel@gnu.org

> > FWIW, +1 for your mail, Arthur -
> > pretty much each of the points you made.
> > ___
> >
> > As one who's used CL (long ago) but is
> > no expert about it or Elisp or Lisp
> > generally, I happen to agree about the
> > usefulness of keyword args _for users_.
> 
> Interestingly, how things can be percieved wrongly over the wire.
> I always percieved you as an CL veteran and expert :).

Nope.  Just a long-ago user.  Being around a
long time can sometimes give the impression
of being a veteran.

> I think his friends, Eli and others, are too kind and
> would do Richard more favor if they told him when he
> is dead wrong 

I have no reason to think Richard is dead
wrong about whether Elisp should have
keyword args.  I just related my (good)
experience with them in CL, as one user,
long ago.

Elisp could of course go in many directions.
That it hasn't taken certain directions I'm
generally thankful for, FWIW.  It's not a
bad language, and not every proposal or
imagined change represents real progress. ;-)



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

* Re: [External] : Re: Shrinking the C core
  2023-09-08 15:38                       ` [External] : " Drew Adams
  2023-09-09 11:55                         ` Arthur Miller
@ 2023-09-11  0:40                         ` Richard Stallman
  2023-09-11 15:10                           ` João Távora
                                             ` (2 more replies)
  1 sibling, 3 replies; 54+ messages in thread
From: Richard Stallman @ 2023-09-11  0:40 UTC (permalink / raw)
  To: Drew Adams; +Cc: arthur.miller, acm, luangruo, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I implemented Common Lisp for the Lisp Machine in 1983.
That included the generic sequence functions with their
many keyword arguments.

In 1984 I wrote Emacs Lisp and decided to omit all that.
I have no regrets.  Their absence makes Emacs Lisp easier to use.

Keyword arguments are fine for an unusual, heavyweight operation such
as creating a frame.  The sort of function whose doc you need to look
up again each time you use it.  When something is as cumbersome as
that, the question of how to pass the arguments is a pile of minor
details that you'll see when you look it up.

But it's a pain in the neck to make simple everyday functions such as
`append' and `length' that cumbersome just for the sake of following a
general system.  Part of this system is that the default argument
values follow the system, rather than following the traditional Lisp
functions -- so getting the traditional behavior requires actually
specifying the keyword arguments to override defaults, almost every
time.

Switching to Common Lisp would cause those painful incompatibilities.
It is unacceptable.

Defining the CL functions with a name prefix is ok, because the
traditional Lisp functions are still available compatibly and we don't
have to use the CL functions.  This is what we have now.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: [External] : Re: Shrinking the C core
  2023-09-11  0:40                         ` Richard Stallman
@ 2023-09-11 15:10                           ` João Távora
  2023-09-11 16:12                             ` Drew Adams
                                               ` (2 more replies)
  2023-09-11 21:09                           ` Eric S. Raymond
  2023-09-12  2:30                           ` Arthur Miller
  2 siblings, 3 replies; 54+ messages in thread
From: João Távora @ 2023-09-11 15:10 UTC (permalink / raw)
  To: rms; +Cc: Drew Adams, arthur.miller, acm, luangruo, emacs-devel

On Mon, Sep 11, 2023 at 1:40 AM Richard Stallman <rms@gnu.org> wrote:

> Keyword arguments are fine for an unusual, heavyweight operation such
> as creating a frame.  The sort of function whose doc you need to look
> up again each time you use it.  When something is as cumbersome as
> that, the question of how to pass the arguments is a pile of minor
> details that you'll see when you look it up.

It's possible that in 1984 there weren't any good at-point-documentation
systems that immediately show the available keyword arguments of a given
call being typed.  I was very young at the time, so I can't attest to it.

But nowadays such systems exist, including built-in, in Emacs.

But even in the absence of those conveniences, each family of functions
in CL, (say, the sequence manipulating functions) take standard sets
of keyword arguments (like :START, :END, :FROM-END, :KEY, :TEST).

This makes them very easy to remember and makes using e.g. CL's SORT
much more practical than Emacs Lisp 'sort'.

> But it's a pain in the neck to make simple everyday functions such as
> `append' and `length' that cumbersome just for the sake of following a
> general system.

APPEND and LENGTH in Common Lisp do not take keyword arguments,
(nor have they ever?) so I believe your argument is weakened by
criticizing a suggestion that no-one is offering.

Let's look at a traditional Elisp macro define-minor-mode.

According to the CVS history, you created this function in 1997, with
three positional optional arguments.  Then more and more arguments
came along.  Possibly due to the realization by Emacs developers
around 2000, already more than 20 years ago,  that positional arguments
are maintenance hazards, the macro now accepts keyword arguments
(and the positional arguments are actively discouraged).

Unfortunately, because cl-lib.el wasn't used for this particular change,
the aforementioned at-point documentation facilities aren't available,
which, to some of us, would appear just another manifestation of
Greenspun's 10th rule (which I assume everyone in this niche topic
is familar with).

Many other functions with a large amount of optional arguments
(completing-read comes to mind) would be much, much easier
to use with keyword arguments.  Without them, we find ourselves
wondering about how many nils to sprinkle before the argument
we want to pass.

João



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

* RE: [External] : Re: Shrinking the C core
  2023-09-11 15:10                           ` João Távora
@ 2023-09-11 16:12                             ` Drew Adams
  2023-09-11 20:37                             ` Tomas Hlavaty
  2023-09-15  8:43                             ` Emanuel Berg
  2 siblings, 0 replies; 54+ messages in thread
From: Drew Adams @ 2023-09-11 16:12 UTC (permalink / raw)
  To: João Távora, rms@gnu.org
  Cc: arthur.miller@live.com, acm@muc.de, luangruo@yahoo.com,
	emacs-devel@gnu.org

I thought my previous post in this thread would
likely be my only such, but I'd like now to add a
point, FWIW.

Richard, you spoke about implementing support for
keyword args in ~CL (Lisp-machine Lisp code that
you wrote), and how you found their presence to be
a bother for implementers and (I think) users.

I mentioned that I appreciated _using_ keyword args
with CL, long ago.  I'll add that it was especially
in code that I wrote that I found them useful (as
opposed to their presence in standard CL code).
That is, for _users_ of my code (but including me,
while developing and testing).  And especially for
functions that allowed for more than a few args.

In a nutshell, with keyword args a single function
can replace multiple related/similar functions.

And when you have multiple things to juggle, it
helps to name them, and it helps to not need to
address them in a particular order.

Here's an analogy:

Imagine Lisp without &optional args.  You'd end by
defining more functions of the same "family".

IME, the same difference applies to the absence of
keyword args.  You end up defining more functions,
for the convenience of not having to specifying a
zillion nil args.  Plus you have to pay attention
to arg order.

Of course sometimes it makes sense to define a
separate function or two, to cover particular
common use cases.  But in general optional args
are handy, and so are keyword args, for the same
reason: many functions in one - a single name to
rule them all. ;-)

Now, if you always _had to_ use keyword args, so
you could _never_ just provide args without names
(in the proper order), then that would definitely
be an unnecessary bother.  We probably all agree
about that.

In Lisp all args to functions are evaluated, and
there really is no user-level dependence on the
order of their evaluation.  Given that, Occam says
that arg order doesn't matter, and there's no real
_need_ to specify args in an order, filling in nil
args as needed to get to the last optional arg you
need.

From a user point of view, being able to have the
option of specifying an arg by its position OR by
its name is just a plus - I don't see any downside.

From the point of view of a language implementer
things might be different, of course.

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

* Re: [External] : Re: Shrinking the C core
  2023-09-11 15:10                           ` João Távora
  2023-09-11 16:12                             ` Drew Adams
@ 2023-09-11 20:37                             ` Tomas Hlavaty
  2023-09-11 21:10                               ` João Távora
  2023-09-15  8:43                             ` Emanuel Berg
  2 siblings, 1 reply; 54+ messages in thread
From: Tomas Hlavaty @ 2023-09-11 20:37 UTC (permalink / raw)
  To: João Távora, rms
  Cc: Drew Adams, arthur.miller, acm, luangruo, emacs-devel

On Mon 11 Sep 2023 at 16:10, João Távora <joaotavora@gmail.com> wrote:
> This makes them very easy to remember and makes using e.g. CL's SORT
> much more practical than Emacs Lisp 'sort'.

not really, it seems that CL:SORT is a bad example

the CL spec defines sort like this:

   sort sequence predicate &key key => sorted-sequence
   stable-sort sequence predicate &key key => sorted-sequence

(btw why two functions and not extra stablep keyword argument?)

it could have been defined as:

   sort sequence predicate &optional key => sorted-sequence
   stable-sort sequence predicate &optional key => sorted-sequence

and the same could be done in elisp which would be backwards compatible

> Let's look at a traditional Elisp macro define-minor-mode.

the usual CL argument list does not seem to be able to express arguments
of such shape

it looks like whoever extended the original argument list did it
"weirdly" using custom ad-hoc single-use argument list parser.

> are maintenance hazards, the macro now accepts keyword arguments

in CL, the arguments would normally be in a list before body, something
like

   (define-minor-mode MODE ([KEYWORD VAL ... ]) [DOC] &rest BODY)



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

* Re: [External] : Re: Shrinking the C core
  2023-09-11  0:40                         ` Richard Stallman
  2023-09-11 15:10                           ` João Távora
@ 2023-09-11 21:09                           ` Eric S. Raymond
  2023-09-12  2:05                             ` Arthur Miller
  2023-09-12  4:38                             ` Gerd Möllmann
  2023-09-12  2:30                           ` Arthur Miller
  2 siblings, 2 replies; 54+ messages in thread
From: Eric S. Raymond @ 2023-09-11 21:09 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Drew Adams, arthur.miller, acm, luangruo, emacs-devel

Richard Stallman <rms@gnu.org>:
> Switching to Common Lisp would cause those painful incompatibilities.
> It is unacceptable.

I did some checking into this a few weeks ago and even wrote a bit of Lisp to do
an audit.  There are other reasons I decided to get up to speed on Common Lisp
recently, and because I have Emacs Lisp engraved on my forebrain this interested
me in getting a good grasp on how incompatible with SBCL it actally is.

Count of elisp core functions: 1476 
Total SBCL/elisp function name collisions: 145 
Primitives identical in elisp and SBCL: 116
Primitives not known identical: 28

The first two lines are crunched from querying SBCL's symbol list and
groveling through the Emacs sourcefiles; I can supply the SBCL code I
write to do this if anybody cares.

The second two lines are from me reading the SBCL documentation a lot;
I needed immediate motivation to do that and this was a good one.

I was able to write trivial implementations for 15 of those 28 collisions.
The 14 I didn't implement are these:

(require read-char read random process-status process-plist print
princ prin1-to-string prin1 load documentation defvar aref)

What this means is that it would, in principle, be possible to write
an SBCL core that implements all of the Emacs primitives, with only a rather
small amount of shim code required to make existing elisp code execute
in an environment where it thinks it sees *all* elisp primitives.

The code would look something like this, where I have deleted all but one emulation
to showcase setting up the emulation environment.

	;; Implement functions shared between CL and elisp in an elisp-like way

	(defun elisp-append (&rest sequences)
	  "(append &rest SEQUENCES)

	  Probably introduced at or before Emacs version 18.
	  This function does not change global state, including the match data.

	Concatenate all the arguments and make the result a list.
	The result is a list whose elements are the elements of all the arguments.
	Each argument may be a list, vector or string.
	The last argument is not copied, just used as the tail of the new list."
	  (apply 'append (mapcar
			  (lambda (it)
			    (if (listp it) it (listp it)))
			  sequences))
	  )

	(defmacro within-elisp (form)
	  "Evaluate FORM in an environment with elisp behavior."
	  `(flet ((append #'emacs-append)
		 (delete-file-internal #'elisp-delete-file-internal)
		 (eval #'elisp-eval)
		 (format #'elisp-format)
		 (intern #'elisp-intern)
		 (make-hash-table #'elisp-make-hash-table)
		 (make-string #'elisp-make-string)
		 (rename-file #'elisp-rename-file)
		 (sort #'elisp-sort)
		 (string #'elisp-string)
		 (string-equal #'elisp-string-equal)
		 (string-lessp #'elisp-string-lessp)
		 (symbol-value #'elisp-symbol-value)
		 (type-of #'elisp-type-of)
		 (unintern #'elisp-unintern)
		 (yes-or-no-p #'elisp-yes-or-no-p)
		 )
	    ,form)
	  )

With this encapsulation, "painful incompatiblities" between elisp and
a core written in SBCL would never need be visible to anyone who put
an .el extension on their code to tell the core it should be executed
using within-elisp.

I'm not minimizing the amount of work an SBCL core would take,
there's a lot of devil in the details of 1476 + 14 primitive
functions.  Nor am I interested in joining a political argument
about whether it should be done; I have too much else on my
plate for that.

But it could be done. There is a technical path forward to it.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>





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

* Re: [External] : Re: Shrinking the C core
  2023-09-11 20:37                             ` Tomas Hlavaty
@ 2023-09-11 21:10                               ` João Távora
  2023-09-12 19:52                                 ` Tomas Hlavaty
  0 siblings, 1 reply; 54+ messages in thread
From: João Távora @ 2023-09-11 21:10 UTC (permalink / raw)
  To: Tomas Hlavaty; +Cc: rms, Drew Adams, arthur.miller, acm, luangruo, emacs-devel

On Mon, Sep 11, 2023 at 9:37 PM Tomas Hlavaty <tom@logand.com> wrote:

> not really, it seems that CL:SORT is a bad example

The example was for comparing to Emacs's lisp 'sort', where
IMO it's much easier to do

  (cl-sort things-having-foo #'< :key #'foo)

than

  (sort things-having-foo (lambda (a b) (< (foo a) (foo b))))

As to the advantage of @key key vs &optional key it is -- in my
eyes,  at least -- that you already know its meaning from many other
functions.

> (btw why two functions and not extra stablep keyword argument?)

Why not? Maybe that makes passing sort and stable-sort to higher
order functions more practical?

> it could have been defined as:
>
>    sort sequence predicate &optional key => sorted-sequence
>    stable-sort sequence predicate &optional key => sorted-sequence
>
> and the same could be done in elisp which would be backwards compatible

Sure, but if according to your conjecture Elisp's grew a &optional
arg, why couldn't it grow a &key arg and be backwards compatible?

> > Let's look at a traditional Elisp macro define-minor-mode.
>
> the usual CL argument list does not seem to be able to express arguments
> of such shape
>
> it looks like whoever extended the original argument list did it
> "weirdly" using custom ad-hoc single-use argument list parser.

Quite likely the cl machinery wasn't available at the time...  But yes,
Greenspun's 10th.

> > are maintenance hazards, the macro now accepts keyword arguments
>
> in CL, the arguments would normally be in a list before body, something
> like
>
>    (define-minor-mode MODE ([KEYWORD VAL ... ]) [DOC] &rest BODY)

OK, but this is irrelevant.  This is a macro, not a function.
For all practical purposes it was extended with keyword arguments.
In fact you could have used cl-lib's cl-destructuring-bind.

João



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

* Re: [External] : Re: Shrinking the C core
  2023-09-11 21:09                           ` Eric S. Raymond
@ 2023-09-12  2:05                             ` Arthur Miller
  2023-09-12  4:38                             ` Gerd Möllmann
  1 sibling, 0 replies; 54+ messages in thread
From: Arthur Miller @ 2023-09-12  2:05 UTC (permalink / raw)
  To: Eric S. Raymond; +Cc: Richard Stallman, Drew Adams, acm, luangruo, emacs-devel

"Eric S. Raymond" <esr@thyrsus.com> writes:

> Richard Stallman <rms@gnu.org>:
>> Switching to Common Lisp would cause those painful incompatibilities.
>> It is unacceptable.
>
> I did some checking into this a few weeks ago and even wrote a bit of Lisp to do
> an audit.  There are other reasons I decided to get up to speed on Common Lisp
> recently, and because I have Emacs Lisp engraved on my forebrain this interested
> me in getting a good grasp on how incompatible with SBCL it actally is.
>
> Count of elisp core functions: 1476 
> Total SBCL/elisp function name collisions: 145 
> Primitives identical in elisp and SBCL: 116
> Primitives not known identical: 28
>
> The first two lines are crunched from querying SBCL's symbol list and
> groveling through the Emacs sourcefiles; I can supply the SBCL code I
> write to do this if anybody cares.
>
> The second two lines are from me reading the SBCL documentation a lot;
> I needed immediate motivation to do that and this was a good one.
>
> I was able to write trivial implementations for 15 of those 28 collisions.
> The 14 I didn't implement are these:
>
> (require read-char read random process-status process-plist print
> princ prin1-to-string prin1 load documentation defvar aref)
>
> What this means is that it would, in principle, be possible to write
> an SBCL core that implements all of the Emacs primitives, with only a rather
> small amount of shim code required to make existing elisp code execute
> in an environment where it thinks it sees *all* elisp primitives.
>
> The code would look something like this, where I have deleted all but one emulation
> to showcase setting up the emulation environment.
>
> 	;; Implement functions shared between CL and elisp in an elisp-like way
>
> 	(defun elisp-append (&rest sequences)
> 	  "(append &rest SEQUENCES)
>
> 	  Probably introduced at or before Emacs version 18.
> 	  This function does not change global state, including the match data.
>
> 	Concatenate all the arguments and make the result a list.
> 	The result is a list whose elements are the elements of all the arguments.
> 	Each argument may be a list, vector or string.
> 	The last argument is not copied, just used as the tail of the new list."
> 	  (apply 'append (mapcar
> 			  (lambda (it)
> 			    (if (listp it) it (listp it)))
> 			  sequences))
> 	  )
>
> 	(defmacro within-elisp (form)
> 	  "Evaluate FORM in an environment with elisp behavior."
> 	  `(flet ((append #'emacs-append)
> 		 (delete-file-internal #'elisp-delete-file-internal)
> 		 (eval #'elisp-eval)
> 		 (format #'elisp-format)
> 		 (intern #'elisp-intern)
> 		 (make-hash-table #'elisp-make-hash-table)
> 		 (make-string #'elisp-make-string)
> 		 (rename-file #'elisp-rename-file)
> 		 (sort #'elisp-sort)
> 		 (string #'elisp-string)
> 		 (string-equal #'elisp-string-equal)
> 		 (string-lessp #'elisp-string-lessp)
> 		 (symbol-value #'elisp-symbol-value)
> 		 (type-of #'elisp-type-of)
> 		 (unintern #'elisp-unintern)
> 		 (yes-or-no-p #'elisp-yes-or-no-p)
> 		 )
> 	    ,form)
> 	  )
>
> With this encapsulation, "painful incompatiblities" between elisp and
> a core written in SBCL would never need be visible to anyone who put
> an .el extension on their code to tell the core it should be executed
> using within-elisp.

There is a little bit more than just this; but that one was very clever
to smooth out basic differences. It all depends on the ambition of
course. I do wrap cl funcitons and re-implement some of those that are
missing in CL just to be able to attach the doc strings to symbols, and
counting on sbcl inlining to remove the function call. I am not sure yet
if it is a good strategy, but I can do it relatively automated. Looks
like this:

(defun take (n list)
  "Return the first N elements of LIST.
If N is zero or negative, return nil.
If N is greater or equal to the length of LIST, return LIST (or a copy)."
  ;; todo - this can probably be done without taking the length of the list
  (cl:when (cl:> n 0)
    (cl:let ((l (cl:length list)))
      (when (cl:> n l) (setf n l))
      (cl:subseq list 0 n))))

(defun ntake (n list)
  "Modify LIST to keep only the first N elements.
If N is zero or negative, return nil.
If N is greater or equal to the length of LIST, return LIST unmodified.
Otherwise, return LIST after truncating it."
  (cl:when (cl:> n 0)
    (cl:let ((l list))
      (eli:while (cl:and (cl:> n 1) (cl:cdr l))
             (cl:setf l (cl:cdr l))
             (cl:decf n))
      (cl:rplacd l nil)
      list)))

(declaim (inline nthcdr))
(defun nthcdr (n list)
  "Take cdr N times on LIST, return the result."
  (cl:nthcdr n list))

(declaim (inline nth))
(defun nth (n list)
  "Return the Nth element of LIST.
N counts from zero.  If LIST is not that long, nil is returned."
  (cl:nth n list))

But tere is more than just functions and macros.

The reader needs some help; Emacs uses different syntax for characters
and escapes for example; ? vs #\, but the escape syntax is were a real
hear pulling is. Also Emacs does not have character type but basically
uses whatever int comes out of C and thus Emacs API can do arithmetic
operaions and comparisons on characters whereas in CL they have to use
character specific operators. I have implemented the reader to
understand ? and escapes and to spit out integer codes instead of cl
characters so I don't need to dispatch on each mathematical operation.

There is still more, "markers are numbers" in Emacs, so mathematical
operations are applicable to those as well. I haven't decided if I will
do same as they do in C sources or I'll try to implement static dispatch
for generic functions and have mathematical operations as generic
functions, I have to test how it works, but there are other things like
those that have to be taken care of. And there is more, that is
just the tip of the iceberg :).

I am also talking only about lisp implemented in C core. There weould be
need to do some work on the elisp side too; eieo, cl-lib, defun/defmacro,
stuff like that, but that is probably by far lesser and easier to fix.

> I'm not minimizing the amount of work an SBCL core would take,
> there's a lot of devil in the details of 1476 + 14 primitive
> functions.  Nor am I interested in joining a political argument
> about whether it should be done; I have too much else on my
> plate for that.

Yes, something like that; it is volumous and lots of work, for one
person probably impossible, but it is not impossible to do. 





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

* Re: [External] : Re: Shrinking the C core
  2023-09-11  0:40                         ` Richard Stallman
  2023-09-11 15:10                           ` João Távora
  2023-09-11 21:09                           ` Eric S. Raymond
@ 2023-09-12  2:30                           ` Arthur Miller
  2023-09-12 12:15                             ` Emanuel Berg
                                               ` (3 more replies)
  2 siblings, 4 replies; 54+ messages in thread
From: Arthur Miller @ 2023-09-12  2:30 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Drew Adams, acm, luangruo, emacs-devel

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> I implemented Common Lisp for the Lisp Machine in 1983.
> That included the generic sequence functions with their
> many keyword arguments.
>
> In 1984 I wrote Emacs Lisp and decided to omit all that.
> I have no regrets.  Their absence makes Emacs Lisp easier to use.

Thank you for explanation and clarficiation. Now at least I understand
why you don't like them.

> Keyword arguments are fine for an unusual, heavyweight operation such
> as creating a frame.  The sort of function whose doc you need to look
> up again each time you use it.  When something is as cumbersome as
> that, the question of how to pass the arguments is a pile of minor
> details that you'll see when you look it up.
>
> But it's a pain in the neck to make simple everyday functions such as
> `append' and `length' that cumbersome just for the sake of following a
> general system.  Part of this system is that the default argument
> values follow the system, rather than following the traditional Lisp
> functions -- so getting the traditional behavior requires actually
> specifying the keyword arguments to override defaults, almost every
> time.

Of course, but nobody suggests it is all-in. `length' is not a keyworded
in CL either. It would be madness to do something like naming all
arguments in all functions. But it is convenient to have keywords in
some places, like for example in define-minor-mode or make-process, or
even "new" define-keymap.

> Switching to Common Lisp would cause those painful incompatibilities.
> It is unacceptable.
>
> Defining the CL functions with a name prefix is ok, because the
> traditional Lisp functions are still available compatibly and we don't
> have to use the CL functions.  This is what we have now.

If cl-lib was loaded into the lisp image, we could even rename cl-defun
to defun, after we have initialized all the other stuff that goes into
the dump, and have "upgraded" vesion of defun and would be fully
compatible with traditional Lisp functions. We could even go further and
remove cl- prefix from bunch of symbols to make them less cumbersome to
use, and everything would stil be compatible with traditional Lisp
functions.

I think there is a thing that makes Lisp a bit special compared to other
programming languages, and Steel mentions it briefly in his legendary
talk: anyone can add a new feature to the language and it becomes part
of the vocabulary without distinction from the built-in stuff. Keyword
arguments does not require anything special from the C runtime, and we
see them pop-up in different forms in elisp. Perhaps elisp would be
better off to accept them and make cl-defun the norm, instead of seing
macros like define-minor-mode re-implement the technique and some other
macro possibly do something similar which leads to more less maintanable
code.

But that is just loud thinking, since my point wasn't to suggest any
changes, I just wanted to understand why you didn't like keyword
arguments per se, so thank you very much for the answer.




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

* Re: [External] : Re: Shrinking the C core
  2023-09-11 21:09                           ` Eric S. Raymond
  2023-09-12  2:05                             ` Arthur Miller
@ 2023-09-12  4:38                             ` Gerd Möllmann
  2023-09-12  5:48                               ` Arthur Miller
  1 sibling, 1 reply; 54+ messages in thread
From: Gerd Möllmann @ 2023-09-12  4:38 UTC (permalink / raw)
  To: Eric S. Raymond
  Cc: Richard Stallman, Drew Adams, arthur.miller, acm, luangruo,
	emacs-devel

"Eric S. Raymond" <esr@thyrsus.com> writes:

 > But it could be done. There is a technical path forward to it.

Which would have to cope with buffer-local bindings.
Just saying :-).




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

* Re: [External] : Re: Shrinking the C core
  2023-09-12  4:38                             ` Gerd Möllmann
@ 2023-09-12  5:48                               ` Arthur Miller
  0 siblings, 0 replies; 54+ messages in thread
From: Arthur Miller @ 2023-09-12  5:48 UTC (permalink / raw)
  To: Gerd Möllmann
  Cc: Eric S. Raymond, Richard Stallman, Drew Adams, acm, luangruo,
	emacs-devel

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> "Eric S. Raymond" <esr@thyrsus.com> writes:
>
>  > But it could be done. There is a technical path forward to it.
>
> Which would have to cope with buffer-local bindings.
> Just saying :-).

I think they can be dealt with in at least two different ways; but I haven't got
so far yet, so I might be wrong.




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

* Re: [External] : Re: Shrinking the C core
  2023-09-12  2:30                           ` Arthur Miller
@ 2023-09-12 12:15                             ` Emanuel Berg
  2023-09-12 12:32                             ` Emanuel Berg
                                               ` (2 subsequent siblings)
  3 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-09-12 12:15 UTC (permalink / raw)
  To: emacs-devel

We should extend the current design so that Emacs is
multi-threaded, for this to happen we should agree on a model
how this is supposed to be done, and after that it is just
a matter what needs to be done and what parts need to be
adopted to realize that model.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-12  2:30                           ` Arthur Miller
  2023-09-12 12:15                             ` Emanuel Berg
@ 2023-09-12 12:32                             ` Emanuel Berg
  2023-09-12 19:57                             ` Tomas Hlavaty
  2023-09-13  0:00                             ` Richard Stallman
  3 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-09-12 12:32 UTC (permalink / raw)
  To: emacs-devel

Arthur Miller wrote:

> Of course, but nobody suggests it is all-in. `length' is not
> a keyworded in CL either. It would be madness to do
> something like naming all arguments in all functions. But it
> is convenient to have keywords in some places [...]

Keywords typically make for shorter interfaces and function
calls that communicate more, however the shorter interface
advantage and the need to have function calls to communicate
more should be put against the typical downside with this
style, which is very long and complicated functions that do
a lot more than they should, often.

And, because very long functions isn't good style anyway,
those should probably be split up - and if they are split up,
the interfaces will be shorter and the style clear that way
instead, so the need for keywords to do that will also be
reduced or disappear, really.

>> Defining the CL functions with a name prefix is ok, because
>> the traditional Lisp functions are still available
>> compatibly and we don't have to use the CL functions.
>> This is what we have now.
>
> If cl-lib was loaded into the lisp image, we could even
> rename cl-defun to defun, after we have initialized all the
> other stuff that goes into the dump, and have "upgraded"
> vesion of defun and would be fully compatible with
> traditional Lisp functions. We could even go further and
> remove cl- prefix from bunch of symbols to make them less
> cumbersome to use, and everything would stil be compatible
> with traditional Lisp functions.

Indeed, that could be done for every cl-X case where X is
a non-cl-lib Elisp function and cl-X already does everything
X does with the same interface. Those could be cancelled out.

For the cases where there is no such X outside of cl-lib, e.g.
`cl-incf' and `cl-decf' (no "incf" or "decf" anymore?) the
cl-lib prefix could also be dropped. Another example is
`cl-loop'. One could solve this with aliases, possibly.

Because yes, it looks a bit strange that such rudimentary
stuff has to be prefixed to note their belonging to some
particular implementation or library, and even more so when
there isn't any competition or alternative, even?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-11 21:10                               ` João Távora
@ 2023-09-12 19:52                                 ` Tomas Hlavaty
  2023-09-12 20:52                                   ` João Távora
  0 siblings, 1 reply; 54+ messages in thread
From: Tomas Hlavaty @ 2023-09-12 19:52 UTC (permalink / raw)
  To: João Távora
  Cc: rms, Drew Adams, arthur.miller, acm, luangruo, emacs-devel

On Mon 11 Sep 2023 at 22:10, João Távora <joaotavora@gmail.com> wrote:
> On Mon, Sep 11, 2023 at 9:37 PM Tomas Hlavaty <tom@logand.com> wrote:
>> not really, it seems that CL:SORT is a bad example
>
> The example was for comparing to Emacs's lisp 'sort', where
> IMO it's much easier to do
>
>   (cl-sort things-having-foo #'< :key #'foo)
>
> than
>
>   (sort things-having-foo (lambda (a b) (< (foo a) (foo b))))

That has nothing to do with &key.
It has everything to do with the lack of the KEY argument
and the KEY argument could as well be &optional instead of &key.


If you find lack of the key argument "much not easier", you can define
your own sort, something like:

   (defun sort3 (seq pred key)
     (sort seq (lambda (a b)
                 (funcall pred
                   (funcall key a)
                   (funcall key b)))))
where

   (sort3 things-having-foo #'< #'foo)

is "much easier to do" than

   (cl-sort things-having-foo #'< :key #'foo)

or

   (sort things-having-foo (lambda (a b) (< (foo a) (foo b))))

Additionally, you'll get much nicer tool support automatically,
e.g. autodoc tells me:

   sort3: (SEQ PRED KEY)
   cl-sort: (SEQ PREDICATE [KEYWORD VALUE]...)

One can see that autodoc for cl-sort is severely crippled.

> As to the advantage of @key key vs &optional key it is -- in my
> eyes,  at least -- that you already know its meaning from many other
> functions.

The point Richard raised was that your "many other functions" with &key
are bad way of doing it.

Simply naming the argument KEY would achieve the same goal of already
knowing its meaning from many other functions.  Making it &key does not
change that.

>> (btw why two functions and not extra stablep keyword argument?)
>
> Why not? Maybe that makes passing sort and stable-sort to higher
> order functions more practical?

That speculation does not sound plausible.

By that logic, CL would probably define 4 functions:

   sort sequence predicate => sorted-sequence
   sort3 sequence predicate key => sorted-sequence
   stable-sort sequence predicate => sorted-sequence
   stable-sort3 sequence predicate key => sorted-sequence

>> > Let's look at a traditional Elisp macro define-minor-mode.
>>
>> the usual CL argument list does not seem to be able to express arguments
>> of such shape
>>
>> it looks like whoever extended the original argument list did it
>> "weirdly" using custom ad-hoc single-use argument list parser.
>
> Quite likely the cl machinery wasn't available at the time...  But yes,
> Greenspun's 10th.
>
>> > are maintenance hazards, the macro now accepts keyword arguments
>>
>> in CL, the arguments would normally be in a list before body, something
>> like
>>
>>    (define-minor-mode MODE ([KEYWORD VAL ... ]) [DOC] &rest BODY)
>
> OK, but this is irrelevant.  This is a macro, not a function.
> For all practical purposes it was extended with keyword arguments.
> In fact you could have used cl-lib's cl-destructuring-bind.

No, that's missing the point.  CL itself is not able to express the
argument list structure in the shape it is implemented in
define-minor-mode.  You need custom argument parser anyway.

autodoc for define-minor-mode is also useless:

   define-minor-mode: (MODE DOC [KEYWORD VAL ... &rest BODY])

The way define-minor-mode sneaks in keyword arguments is pretty bad.  It
implements custom argument list parser and makes tools that understand
and work with argument lists useless, which causes extra manual work in
other areas.  If there was a unified argument list parser implemented in
one place and used consistently, it would avoid lots of manual work.

Back to the [KEYWORD VAL ... ] example, putting the argument list of the
macro into an extra list would allow one to use unified argument list
parser, but the way define-minor-mode arguments are specified at the
moment, CL:DESTRUCTURING-BIND cannot destructure such structure (&key
before &rest/&body is malformed).

Another example, take &body as opposed to &rest.  It automatically
declares the intent and how the indentation is meant to be computed.
With &rest indentation needs to be specified individually and manually
per case.  Lack of &body in elisp is annoying inconvenience.  Example:
(with-help-window BUFFER-OR-NAME &rest BODY) has (declare (indent 1))
which would not be needed if it was (with-help-window BUFFER-OR-NAME
&body BODY).

I think that rather than arguing about keyword arguments only, it would
be better to push for a unified argument list format which would be
followed, understood and supported by relevant tools.  So far, argument
list structure in elisp grew into ad-hoc mess which one needs to decode
manually from docstring on case by case basis; and no amount of CL would
help.



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

* Re: [External] : Re: Shrinking the C core
  2023-09-12  2:30                           ` Arthur Miller
  2023-09-12 12:15                             ` Emanuel Berg
  2023-09-12 12:32                             ` Emanuel Berg
@ 2023-09-12 19:57                             ` Tomas Hlavaty
  2023-09-13  0:00                             ` Richard Stallman
  3 siblings, 0 replies; 54+ messages in thread
From: Tomas Hlavaty @ 2023-09-12 19:57 UTC (permalink / raw)
  To: Arthur Miller, Richard Stallman; +Cc: Drew Adams, acm, luangruo, emacs-devel

On Tue 12 Sep 2023 at 04:30, Arthur Miller <arthur.miller@live.com> wrote:
> Perhaps elisp would be better off to accept them and make cl-defun the
> norm, instead of seing macros like define-minor-mode re-implement the
> technique and some other macro possibly do something similar which
> leads to more less maintanable code.

cl-defmacro would not help with define-minor-mode because it cannot
describe the special argument list structure in this case.



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

* Re: [External] : Re: Shrinking the C core
  2023-09-12 19:52                                 ` Tomas Hlavaty
@ 2023-09-12 20:52                                   ` João Távora
  0 siblings, 0 replies; 54+ messages in thread
From: João Távora @ 2023-09-12 20:52 UTC (permalink / raw)
  To: Tomas Hlavaty; +Cc: rms, Drew Adams, arthur.miller, acm, luangruo, emacs-devel

On Tue, Sep 12, 2023 at 8:52 PM Tomas Hlavaty <tom@logand.com> wrote:

> It has everything to do with the lack of the KEY argument
> and the KEY argument could as well be &optional instead of &key.

Yes, it could, but should it?  I think not, because consistency.
You think yes, because whatever, so let's just disagree.

> If you find lack of the key argument "much not easier", you can define
> your own sort, something like:

The point with having good library functions is that the user doesn't
need to define her ad-hoc versions.

> One can see that autodoc for cl-sort is severely crippled.

That's a problem with autodoc and cl-sort's definition, not its protocol.
Functions defined with cl-func are much better and autodoc functionality
for SLIME/SLY is spot on and detects the correct argument.  This is
no technical hurdle.

João



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

* Re: [External] : Re: Shrinking the C core
  2023-09-12  2:30                           ` Arthur Miller
                                               ` (2 preceding siblings ...)
  2023-09-12 19:57                             ` Tomas Hlavaty
@ 2023-09-13  0:00                             ` Richard Stallman
  3 siblings, 0 replies; 54+ messages in thread
From: Richard Stallman @ 2023-09-13  0:00 UTC (permalink / raw)
  To: Arthur Miller; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Of course, but nobody suggests it is all-in. `length' is not a keyworded
  > in CL either.

Oops, I thought it was -- but the time when I implemented and used
Common Lisp was 40 years ago.

I am pretty sure `member' used keyword arguments, and I think that
getting behavior equivalent to traditional Lisp `member' required
specifying a keyword argument.  I never forgot that, during that
period, because I got reminded of it almost every day.

  >  But it is convenient to have keywords in
  > some places, like for example in define-minor-mode or make-process, or
  > even "new" define-keymap.

I would not object to using keyword arguments for functions like that
-- complex and cumbersome to use, and not used often.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: [External] : Re: Shrinking the C core
@ 2023-09-13  5:24 Arthur Miller
  2023-09-15  8:18 ` Emanuel Berg
  0 siblings, 1 reply; 54+ messages in thread
From: Arthur Miller @ 2023-09-13  5:24 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>[[[ To any NSA and FBI agents reading my email: please consider    ]]]
>[[[ whether defending the US Constitution against all enemies,     ]]]
>[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>  > Of course, but nobody suggests it is all-in. `length' is not a keyworded
>  > in CL either.
>
>Oops, I thought it was -- but the time when I implemented and used
>Common Lisp was 40 years ago.
>
>I am pretty sure `member' used keyword arguments, and I think that
>getting behavior equivalent to traditional Lisp `member' required
>specifying a keyword argument.  I never forgot that, during that
>period, because I got reminded of it almost every day.
>
>  >  But it is convenient to have keywords in
>  > some places, like for example in define-minor-mode or make-process, or
>  > even "new" define-keymap.
>
>I would not object to using keyword arguments for functions like that
>-- complex and cumbersome to use, and not used often.

Well, than we pretty much agree 100% about keyword args. 40 years ago I
was playing in the woods, but as I have learned Lisp some barely 2 or 3
years ago, thanks to Emacs Lisp, that is pretty much how I understand
keyword arguments and why they are used, so that is why it felt a bit
strange when you said you don't want them, but I understand now that you
might have felt aversion if they were used everywhere; it certainly is a
PITA in functions with small number of arguments.

Question is also, if Maclisp was developed further, to current day, if
and how it would evolve itself. As time goes buy we discover new idioms,
patterns, have different needs etc. These things changes and new ideas
emerges; it is very much probable that Maclisp itself would look
differently than what it was when CL was conceived. I am sure they
wouldn't have those paires of complementatry functions
(remove-if/remove-if-not) which make for a big part of CL verbosity too.




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

* Re: [External] : Re: Shrinking the C core
  2023-09-13  5:24 Arthur Miller
@ 2023-09-15  8:18 ` Emanuel Berg
  2023-09-17  0:46   ` Richard Stallman
  0 siblings, 1 reply; 54+ messages in thread
From: Emanuel Berg @ 2023-09-15  8:18 UTC (permalink / raw)
  To: emacs-devel

Arthur Miller wrote:

> I am sure they wouldn't have those paires of complementatry
> functions (remove-if/remove-if-not) which make for a big
> part of CL verbosity too.

What is wrong with them?

We have them in Elisp as well, `cl-remove-if' and
`cl-remove-if-not', both in cl-seq.el.

Those functions are pretty useful IMO including use which
includes the keywords, all tho that is optional.

The only thing negative is the documentation, see for example
the docstring of `cl-remove-if-not':

  Remove all items not satisfying PREDICATE in SEQ.
  This is a non-destructive function; it makes a copy of SEQ
  if necessary to avoid corrupting the original SEQ.

  Keywords supported:  :key :count :start :end :from-end

As you see, it only says what keywords are "supported", not
what they express or how they effect the execution of
the function.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-11 15:10                           ` João Távora
  2023-09-11 16:12                             ` Drew Adams
  2023-09-11 20:37                             ` Tomas Hlavaty
@ 2023-09-15  8:43                             ` Emanuel Berg
  2 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-09-15  8:43 UTC (permalink / raw)
  To: emacs-devel

João Távora wrote:

> Many other functions with a large amount of optional
> arguments (completing-read comes to mind) would be much,
> much easier to use with keyword arguments. Without them, we
> find ourselves wondering about how many nils to sprinkle
> before the argument we want to pass.

Agreed, it is better with keyword arguments than a long list
of nils because of optional arguments.

But it is better yet to not have the functions take so many
arguments in the first place, but to split them up and have
the function name be more specific what is going to happen.

Sometimes this just doesn't happen, it's life and I have
a hard time seeing any situation (long list of nils for
optional arguments vs. keywords) being a real problem
to anyone?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-15  8:18 ` Emanuel Berg
@ 2023-09-17  0:46   ` Richard Stallman
  2023-09-17  4:55     ` Alfred M. Szmidt
                       ` (2 more replies)
  0 siblings, 3 replies; 54+ messages in thread
From: Richard Stallman @ 2023-09-17  0:46 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > We have them in Elisp as well, `cl-remove-if' and
  > `cl-remove-if-not', both in cl-seq.el.

A partial emulation of some Common Lisp functions is present
in the cl-lib library, for emulation purposes.  It is not supposed to
be used a lot.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  0:46   ` Richard Stallman
@ 2023-09-17  4:55     ` Alfred M. Szmidt
  2023-09-17  9:13       ` Emanuel Berg
  2023-09-17  5:41     ` Eli Zaretskii
  2023-10-20  7:48     ` Arsen Arsenović
  2 siblings, 1 reply; 54+ messages in thread
From: Alfred M. Szmidt @ 2023-09-17  4:55 UTC (permalink / raw)
  To: rms; +Cc: incal, emacs-devel


   [[[ To any NSA and FBI agents reading my email: please consider    ]]]
   [[[ whether defending the US Constitution against all enemies,     ]]]
   [[[ foreign or domestic, requires you to follow Snowden's example. ]]]

     > We have them in Elisp as well, `cl-remove-if' and
     > `cl-remove-if-not', both in cl-seq.el.

   A partial emulation of some Common Lisp functions is present
   in the cl-lib library, for emulation purposes.  It is not supposed to
   be used a lot.

And if there are functions or features that make sense from Common
Lisp, they can always be added piecemeal.  There is no need to make
Emacs Lisp complicated for the sake of compatibility with Common Lisp.

Someone mentioned &optional, and with default values -- that would be
a nice addition to Emacs Lisp.



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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  0:46   ` Richard Stallman
  2023-09-17  4:55     ` Alfred M. Szmidt
@ 2023-09-17  5:41     ` Eli Zaretskii
  2023-09-17  8:54       ` Emanuel Berg
  2023-10-15  1:53       ` Richard Stallman
  2023-10-20  7:48     ` Arsen Arsenović
  2 siblings, 2 replies; 54+ messages in thread
From: Eli Zaretskii @ 2023-09-17  5:41 UTC (permalink / raw)
  To: rms; +Cc: incal, emacs-devel

> From: Richard Stallman <rms@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Sat, 16 Sep 2023 20:46:24 -0400
> 
> A partial emulation of some Common Lisp functions is present
> in the cl-lib library, for emulation purposes.  It is not supposed to
> be used a lot.

466 out of 1637 Lisp files in Emacs require cl-lib (some of them only
during compilation, i.e. they use only the macros).



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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  5:41     ` Eli Zaretskii
@ 2023-09-17  8:54       ` Emanuel Berg
  2023-09-17 17:29         ` Drew Adams
  2023-10-15  1:53       ` Richard Stallman
  1 sibling, 1 reply; 54+ messages in thread
From: Emanuel Berg @ 2023-09-17  8:54 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii wrote:

>> A partial emulation of some Common Lisp functions is
>> present in the cl-lib library, for emulation purposes.
>> It is not supposed to be used a lot.
>
> 466 out of 1637 Lisp files in Emacs require cl-lib (some of
> them only during compilation, i.e. they use only the
> macros).

466 out of 1637 files is 28%. It seems that, regardless of any
anti cl-lib sentiments present, the issue has been decided on
the field already.

(format "%d%%" (round (* 100 (/ 466 1637.0)))) ; 28%

The only thing that would have made it more striking is if
Emacs had 1337 files instead.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  4:55     ` Alfred M. Szmidt
@ 2023-09-17  9:13       ` Emanuel Berg
  2023-09-17  9:54         ` Alfred M. Szmidt
                           ` (2 more replies)
  0 siblings, 3 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-09-17  9:13 UTC (permalink / raw)
  To: emacs-devel

Alfred M. Szmidt wrote:

>>> We have them in Elisp as well, `cl-remove-if' and
>>> `cl-remove-if-not', both in cl-seq.el.
>>
>> A partial emulation of some Common Lisp functions is
>> present in the cl-lib library, for emulation purposes.
>> It is not supposed to be used a lot.
>
> And if there are functions or features that make sense from
> Common Lisp, they can always be added piecemeal. There is no
> need to make Emacs Lisp complicated for the sake of
> compatibility with Common Lisp.

I don't know why cl-lib was added to GNU Emacs and Emacs Lisp,
maybe it was, as you say, for emulation purposes and for the
sake of compatibility with Common Lisp. But the way it is used
today, as we just heard in 28% of vanilla Emacs files, isn't
because of CL emulation or compatibility purposes, but because
it adds useful features and covers aspects that non-cl-lib
Elisp leaves blank.

For functions like `cl-incf', where there is no corresponding
"incf" [I don't know whatever happened to it or why it was
dropped, or maybe it wasn't ever there before cl-lib?] one
could setup aliases or simply drop the "cl-" prefix (and set
an "cl-incf" alias to the new "incf" as not to break existing
code).

Then, for functions like `cl-defun' and `defun', one would
examine if those could be merged into a new "defun", with the
CL features brought over, e.g. the default &optional argument
value syntax. Here one would again use aliases to cover
the back.

For functions that cannot be merged because they are
inherently different, if such cases exist, one would keep the
"cl-" prefix and the incompatible non-cl-lib Elisp function.

But one could also just leave it the way it is! Since those
prefixes are hardly a big problem. And especially not compared
to all the good features cl-lib brings to our game.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  9:13       ` Emanuel Berg
@ 2023-09-17  9:54         ` Alfred M. Szmidt
  2023-09-17 17:38         ` Drew Adams
  2023-09-19 10:21         ` Richard Stallman
  2 siblings, 0 replies; 54+ messages in thread
From: Alfred M. Szmidt @ 2023-09-17  9:54 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

One should think carefully before thinking of what one should do, or
would do.  What one can do is anything... and that is not always the
best thing, these things should be done very carefully and on a case
by case basis.  So lets not go crazy.



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

* RE: [External] : Re: Shrinking the C core
  2023-09-17  8:54       ` Emanuel Berg
@ 2023-09-17 17:29         ` Drew Adams
  2023-09-18 19:40           ` Emanuel Berg
  0 siblings, 1 reply; 54+ messages in thread
From: Drew Adams @ 2023-09-17 17:29 UTC (permalink / raw)
  To: Emanuel Berg, emacs-devel@gnu.org

> (format "%d%%" (round (* 100 (/ 466 1637.0)))) ; 28%


OT, but wrt `format':

Recently I've seen some questions on SE.Emacs that
resulted from users trying to use Common Lisp's
`format' in Elisp, that is, trying to use `format'
with DESTINATION first arg and with Common Lisp's
kind of CONTROL-STRING arg.



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

* RE: [External] : Re: Shrinking the C core
  2023-09-17  9:13       ` Emanuel Berg
  2023-09-17  9:54         ` Alfred M. Szmidt
@ 2023-09-17 17:38         ` Drew Adams
  2023-09-18 19:38           ` Emanuel Berg
  2023-09-19 10:19           ` Richard Stallman
  2023-09-19 10:21         ` Richard Stallman
  2 siblings, 2 replies; 54+ messages in thread
From: Drew Adams @ 2023-09-17 17:38 UTC (permalink / raw)
  To: Emanuel Berg, emacs-devel@gnu.org

> For functions like `cl-incf', where there is no corresponding
> "incf" [I don't know whatever happened to it or why it was
> dropped, or maybe it wasn't ever there before cl-lib?] one
> could setup aliases or simply drop the "cl-" prefix (and set
> an "cl-incf" alias to the new "incf" as not to break existing
> code).

The CL emulation was originally in file `cl.el' and
its helper files, such as `cl-macs.el'.  At that time
functions/macros such as `cl-incf' and `cl-case' had
no `cl-' prefix.  E.g., Emacs 20:
___

 incf is a Lisp macro in `cl'.
 (incf PLACE &optional X)

 (incf PLACE [X]): increment PLACE by X (1 by default).
 PLACE may be a symbol, or any generalized variable allowed by `setf'.
 The return value is the incremented value of PLACE.
___

 case is a Lisp macro in `cl-macs'.
 (case EXPR &rest CLAUSES)

 (case EXPR CLAUSES...): evals EXPR, chooses from CLAUSES on that value.
 Each clause looks like (KEYLIST BODY...).  EXPR is evaluated and compared
 against each key in each KEYLIST; the corresponding BODY is evaluated.
 If no clause succeeds, case returns nil.  A single atom may be used in
 place of a KEYLIST of one atom.  A KEYLIST of `t' or `otherwise' is
 allowed only in the final clause, and matches if no other keys match.
 Key values are compared by `eql'.
___

There's no `incf' or `case' in Elisp that would
conflict with the CL-emulation definitions, but
when Someone decided to prefix CL thingies with
`cl-' the decision was to do it wholesale, not
just where there was a collision/conflict with
existing Elisp thingies.



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

* Re: [External] : Re: Shrinking the C core
  2023-09-17 17:38         ` Drew Adams
@ 2023-09-18 19:38           ` Emanuel Berg
  2023-09-19 10:19           ` Richard Stallman
  1 sibling, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-09-18 19:38 UTC (permalink / raw)
  To: emacs-devel

Drew Adams wrote:

>> For functions like `cl-incf', where there is no
>> corresponding "incf" [I don't know whatever happened to it
>> or why it was dropped, or maybe it wasn't ever there before
>> cl-lib?] [...]
>
> The CL emulation was originally in file `cl.el' and its
> helper files, such as `cl-macs.el'. At that time
> functions/macros such as `cl-incf' and `cl-case' had no
> `cl-' prefix. [...]
>
> There's no `incf' or `case' in Elisp that would conflict
> with the CL-emulation definitions, but when Someone decided
> to prefix CL thingies with `cl-' the decision was to do it
> wholesale, not just where there was a collision/conflict
> with existing Elisp thingies.

Ah, I see!

Thanks for explaining.

So I remembered correctly then, that I did use "incf" before
`cl-incf'!

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-17 17:29         ` Drew Adams
@ 2023-09-18 19:40           ` Emanuel Berg
  0 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-09-18 19:40 UTC (permalink / raw)
  To: emacs-devel

Drew Adams wrote:

>> (format "%d%%" (round (* 100 (/ 466 1637.0)))) ; 28%
>
> OT, but wrt `format':
>
> Recently I've seen some questions on SE.Emacs that resulted
> from users trying to use Common Lisp's `format' in Elisp,
> that is, trying to use `format' with DESTINATION first arg
> and with Common Lisp's kind of CONTROL-STRING arg.

Maybe we should have a "cl-format" then for the CL format of
`format'?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-17 17:38         ` Drew Adams
  2023-09-18 19:38           ` Emanuel Berg
@ 2023-09-19 10:19           ` Richard Stallman
  1 sibling, 0 replies; 54+ messages in thread
From: Richard Stallman @ 2023-09-19 10:19 UTC (permalink / raw)
  To: Drew Adams; +Cc: incal, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I think the reason we added `cl-' to all the CL emulations is to
inform people that they are not parts of what Emacs Lisp supports.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  9:13       ` Emanuel Berg
  2023-09-17  9:54         ` Alfred M. Szmidt
  2023-09-17 17:38         ` Drew Adams
@ 2023-09-19 10:21         ` Richard Stallman
  2023-09-19 11:21           ` Emanuel Berg
  2 siblings, 1 reply; 54+ messages in thread
From: Richard Stallman @ 2023-09-19 10:21 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > But the way it is used
  > today, as we just heard in 28% of vanilla Emacs files, isn't
  > because of CL emulation or compatibility purposes, but because
  > it adds useful features and covers aspects that non-cl-lib
  > Elisp leaves blank.

I consider this a problem.  Such frequent use of the cl facilities --
even though it is just the macros -- adds those cl macros to what
people need to know to understand those files.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: [External] : Re: Shrinking the C core
  2023-09-19 10:21         ` Richard Stallman
@ 2023-09-19 11:21           ` Emanuel Berg
  2023-09-19 12:39             ` Eli Zaretskii
  2023-09-21 20:27             ` Richard Stallman
  0 siblings, 2 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-09-19 11:21 UTC (permalink / raw)
  To: emacs-devel

Richard Stallman wrote:

>> But the way it is used today, as we just heard in 28% of
>> vanilla Emacs files, isn't because of CL emulation or
>> compatibility purposes, but because it adds useful features
>> and covers aspects that non-cl-lib Elisp leaves blank.
>
> I consider this a problem. Such frequent use of the cl
> facilities -- even though it is just the macros -- adds
> those cl macros to what people need to know to understand
> those files.

Okay, I understand. I must admit I don't really care about
other people at such a fine grained level, but let's think
then ...

I think that non-programmers are a lost cause in this case
anyway and for programmers the complexity increase from
non-cl-lib Elisp to cl-lib is pretty much negligible?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-19 11:21           ` Emanuel Berg
@ 2023-09-19 12:39             ` Eli Zaretskii
  2023-09-21 20:27             ` Richard Stallman
  1 sibling, 0 replies; 54+ messages in thread
From: Eli Zaretskii @ 2023-09-19 12:39 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

> From: Emanuel Berg <incal@dataswamp.org>
> Date: Tue, 19 Sep 2023 13:21:59 +0200
> 
> for programmers the complexity increase from non-cl-lib Elisp to
> cl-lib is pretty much negligible?

No, it isn't.  There's quite a lot of different syntax and semantics
that need to be learned and mastered.



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

* Re: [External] : Re: Shrinking the C core
  2023-09-19 11:21           ` Emanuel Berg
  2023-09-19 12:39             ` Eli Zaretskii
@ 2023-09-21 20:27             ` Richard Stallman
  1 sibling, 0 replies; 54+ messages in thread
From: Richard Stallman @ 2023-09-21 20:27 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I think that non-programmers are a lost cause in this case
  > anyway and for programmers the complexity increase from
  > non-cl-lib Elisp to cl-lib is pretty much negligible?

This dichotomy oversimplifies the various levels of skill and
knowledge that people have for Emacs Lisp programming.  People's skill
at programming varies across a wide range.  Programmers' knowledge of
Emacs Lisp likewise -- there is so much you could learn if you want to
but few have time to learn it all.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  5:41     ` Eli Zaretskii
  2023-09-17  8:54       ` Emanuel Berg
@ 2023-10-15  1:53       ` Richard Stallman
  2023-10-15  2:46         ` Emanuel Berg
  2023-10-15  5:54         ` Eli Zaretskii
  1 sibling, 2 replies; 54+ messages in thread
From: Richard Stallman @ 2023-10-15  1:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: incal, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > 466 out of 1637 Lisp files in Emacs require cl-lib (some of them only
  > during compilation, i.e. they use only the macros).

If a file uses cl only during compilation (for macros) it is
not much of a problem.  How many use it at run time?

I reported one file a few weeks ago that is always (or nearly always)
loaded and uses cl-lib, forcin it to be nearly always loaded too.
That should be fixed.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: [External] : Re: Shrinking the C core
  2023-10-15  1:53       ` Richard Stallman
@ 2023-10-15  2:46         ` Emanuel Berg
  2023-10-15  5:57           ` Eli Zaretskii
  2023-10-15  5:54         ` Eli Zaretskii
  1 sibling, 1 reply; 54+ messages in thread
From: Emanuel Berg @ 2023-10-15  2:46 UTC (permalink / raw)
  To: emacs-devel

Richard Stallman wrote:

>> 466 out of 1637 Lisp files in Emacs require cl-lib (some of
>> them only during compilation, i.e. they use only the
>> macros).
>
> If a file uses cl only during compilation (for macros) it is
> not much of a problem. How many use it at run time?
>
> I reported one file a few weeks ago that is always (or
> nearly always) loaded and uses cl-lib, forcin it to be
> nearly always loaded too. That should be fixed.

But if it is shipped and included with vanilla Emacs, which it
is, how can it be either any more or any less (dis)encouraged
for use than anything else included on the same premises?

If something isn't part of vanilla Emacs one can maybe say
"see if you can do without it, because if you use it, it has
to be brought in externally adding complexity" - perhaps.

But it _is_ included so in terms of technology it is on the
same level as everything else included. Are we gonna have one
big toolbox containing a bunch of tools, but on certain tools
put on little stickers saying "don't use this"?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-10-15  1:53       ` Richard Stallman
  2023-10-15  2:46         ` Emanuel Berg
@ 2023-10-15  5:54         ` Eli Zaretskii
  2023-10-17  4:51           ` Emanuel Berg
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2023-10-15  5:54 UTC (permalink / raw)
  To: rms; +Cc: incal, emacs-devel

> From: Richard Stallman <rms@gnu.org>
> Cc: incal@dataswamp.org, emacs-devel@gnu.org
> Date: Sat, 14 Oct 2023 21:53:56 -0400
> 
>   > 466 out of 1637 Lisp files in Emacs require cl-lib (some of them only
>   > during compilation, i.e. they use only the macros).
> 
> If a file uses cl only during compilation (for macros) it is
> not much of a problem.  How many use it at run time?

226.

> I reported one file a few weeks ago that is always (or nearly always)
> loaded and uses cl-lib, forcin it to be nearly always loaded too.
> That should be fixed.

Which file was that?  I cannot reason about its causes to load cl-lib
without knowing the details, which include looking into the file and
considering what it does.



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

* Re: [External] : Re: Shrinking the C core
  2023-10-15  2:46         ` Emanuel Berg
@ 2023-10-15  5:57           ` Eli Zaretskii
  0 siblings, 0 replies; 54+ messages in thread
From: Eli Zaretskii @ 2023-10-15  5:57 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

> From: Emanuel Berg <incal@dataswamp.org>
> Date: Sun, 15 Oct 2023 04:46:45 +0200
> 
> Richard Stallman wrote:
> 
> >> 466 out of 1637 Lisp files in Emacs require cl-lib (some of
> >> them only during compilation, i.e. they use only the
> >> macros).
> >
> > If a file uses cl only during compilation (for macros) it is
> > not much of a problem. How many use it at run time?
> >
> > I reported one file a few weeks ago that is always (or
> > nearly always) loaded and uses cl-lib, forcin it to be
> > nearly always loaded too. That should be fixed.
> 
> But if it is shipped and included with vanilla Emacs, which it
> is, how can it be either any more or any less (dis)encouraged
> for use than anything else included on the same premises?
> 
> If something isn't part of vanilla Emacs one can maybe say
> "see if you can do without it, because if you use it, it has
> to be brought in externally adding complexity" - perhaps.
> 
> But it _is_ included so in terms of technology it is on the
> same level as everything else included. Are we gonna have one
> big toolbox containing a bunch of tools, but on certain tools
> put on little stickers saying "don't use this"?

This thread is not for casual users of Emacs, it is for active Emacs
developers and maintainers.  So please just read it and don't try to
chime in, as that doesn't help.



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

* Re: [External] : Re: Shrinking the C core
  2023-10-15  5:54         ` Eli Zaretskii
@ 2023-10-17  4:51           ` Emanuel Berg
  0 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-10-17  4:51 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii wrote:

>>> 466 out of 1637 Lisp files in Emacs require cl-lib (some
>>> of them only during compilation, i.e. they use only the
>>> macros).
>> 
>> If a file uses cl only during compilation (for macros) it
>> is not much of a problem. How many use it at run time?
>
> 226.

That means that, out of a total number of 1637 Lisp files in
vanilla Emacs,

466 files, or 28%, require cl-lib overall;

240 files, or 15%, use cl-lib at compile time; and

226 files, or 14%, use cl-lib at run time.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: Shrinking the C core
  2023-09-17  0:46   ` Richard Stallman
  2023-09-17  4:55     ` Alfred M. Szmidt
  2023-09-17  5:41     ` Eli Zaretskii
@ 2023-10-20  7:48     ` Arsen Arsenović
  2023-10-20 10:08       ` Alfred M. Szmidt
  2 siblings, 1 reply; 54+ messages in thread
From: Arsen Arsenović @ 2023-10-20  7:48 UTC (permalink / raw)
  To: rms; +Cc: Emanuel Berg, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

Hi,

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > We have them in Elisp as well, `cl-remove-if' and
>   > `cl-remove-if-not', both in cl-seq.el.
>
> A partial emulation of some Common Lisp functions is present
> in the cl-lib library, for emulation purposes.  It is not supposed to
> be used a lot.

Apologies for my ignorance (and late reply), but why not?  It hosts some
quite useful functions.

For instance, I'm not aware of an ``flet'' equivalent in Elisp proper.

Thanks in advance, have a lovely day.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: [External] : Re: Shrinking the C core
  2023-10-20  7:48     ` Arsen Arsenović
@ 2023-10-20 10:08       ` Alfred M. Szmidt
  2023-10-21  8:22         ` Emanuel Berg
  0 siblings, 1 reply; 54+ messages in thread
From: Alfred M. Szmidt @ 2023-10-20 10:08 UTC (permalink / raw)
  Cc: rms, incal, emacs-devel


   For instance, I'm not aware of an ``flet'' equivalent in Elisp proper.

There was a flet, but it had different semantics from cl-flet.  And
was thus removed / made obsolete.



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

* Re: [External] : Re: Shrinking the C core
  2023-10-20 10:08       ` Alfred M. Szmidt
@ 2023-10-21  8:22         ` Emanuel Berg
  0 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg @ 2023-10-21  8:22 UTC (permalink / raw)
  To: emacs-devel

Alfred M. Szmidt wrote:

>> For instance, I'm not aware of an ``flet'' equivalent in
>> Elisp proper.
>
> There was a flet, but it had different semantics from
> cl-flet. And was thus removed / made obsolete.

You used to be able to use "labels" for that. But it is now
removed, however there is `cl-labels'.

-- 
underground experts united
https://dataswamp.org/~incal




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

end of thread, other threads:[~2023-10-21  8:22 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13 11:20 Shrinking the C core Gerd Möllmann
2023-08-13 12:52 ` Ihor Radchenko
2023-08-13 15:53   ` [External] : " Drew Adams
2023-08-14  2:25     ` Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2023-09-13  5:24 Arthur Miller
2023-09-15  8:18 ` Emanuel Berg
2023-09-17  0:46   ` Richard Stallman
2023-09-17  4:55     ` Alfred M. Szmidt
2023-09-17  9:13       ` Emanuel Berg
2023-09-17  9:54         ` Alfred M. Szmidt
2023-09-17 17:38         ` Drew Adams
2023-09-18 19:38           ` Emanuel Berg
2023-09-19 10:19           ` Richard Stallman
2023-09-19 10:21         ` Richard Stallman
2023-09-19 11:21           ` Emanuel Berg
2023-09-19 12:39             ` Eli Zaretskii
2023-09-21 20:27             ` Richard Stallman
2023-09-17  5:41     ` Eli Zaretskii
2023-09-17  8:54       ` Emanuel Berg
2023-09-17 17:29         ` Drew Adams
2023-09-18 19:40           ` Emanuel Berg
2023-10-15  1:53       ` Richard Stallman
2023-10-15  2:46         ` Emanuel Berg
2023-10-15  5:57           ` Eli Zaretskii
2023-10-15  5:54         ` Eli Zaretskii
2023-10-17  4:51           ` Emanuel Berg
2023-10-20  7:48     ` Arsen Arsenović
2023-10-20 10:08       ` Alfred M. Szmidt
2023-10-21  8:22         ` Emanuel Berg
2023-08-27 15:14 Arthur Miller
2023-08-28  1:41 ` Po Lu
2023-08-28  4:53   ` Arthur Miller
2023-08-28  5:36     ` Po Lu
2023-08-28  6:55       ` Arthur Miller
2023-08-28  7:31         ` Po Lu
2023-08-28 14:08           ` Arthur Miller
2023-08-31  2:07             ` Richard Stallman
2023-09-06  0:58               ` Richard Stallman
2023-09-06  5:04                 ` Arthur Miller
2023-09-06 11:29                   ` Alan Mackenzie
2023-09-08  2:00                     ` Arthur Miller
2023-09-08 15:38                       ` [External] : " Drew Adams
2023-09-09 11:55                         ` Arthur Miller
2023-09-09 12:55                           ` Eli Zaretskii
2023-09-09 13:20                             ` Arthur Miller
2023-09-10  0:09                           ` Drew Adams
2023-09-11  0:40                         ` Richard Stallman
2023-09-11 15:10                           ` João Távora
2023-09-11 16:12                             ` Drew Adams
2023-09-11 20:37                             ` Tomas Hlavaty
2023-09-11 21:10                               ` João Távora
2023-09-12 19:52                                 ` Tomas Hlavaty
2023-09-12 20:52                                   ` João Távora
2023-09-15  8:43                             ` Emanuel Berg
2023-09-11 21:09                           ` Eric S. Raymond
2023-09-12  2:05                             ` Arthur Miller
2023-09-12  4:38                             ` Gerd Möllmann
2023-09-12  5:48                               ` Arthur Miller
2023-09-12  2:30                           ` Arthur Miller
2023-09-12 12:15                             ` Emanuel Berg
2023-09-12 12:32                             ` Emanuel Berg
2023-09-12 19:57                             ` Tomas Hlavaty
2023-09-13  0:00                             ` Richard Stallman
2023-08-09  9:46 Eric S. Raymond
2023-08-09 12:34 ` Po Lu
2023-08-09 15:51   ` Eric S. Raymond
2023-08-09 23:56     ` Po Lu
2023-08-10  1:19       ` Eric S. Raymond
2023-08-10 11:28         ` Dmitry Gutov
2023-08-12  2:46           ` Richard Stallman
2023-08-12  3:22             ` Emanuel Berg
2023-08-12 18:32               ` tomas
2023-08-12 23:09                 ` Emanuel Berg
2023-08-13  5:50                   ` tomas
2023-08-13 15:54                     ` [External] : " Drew Adams
2023-08-13  8:00                   ` Andreas Schwab
2023-08-13  9:21                     ` Emanuel Berg
2023-08-14  7:27                       ` Alfred M. Szmidt
2023-08-14  7:36                         ` Ihor Radchenko
2023-08-14  7:50                           ` Alfred M. Szmidt
2023-08-15 22:57                             ` Emanuel Berg
2023-08-16 10:27                               ` Ihor Radchenko
2023-08-19 13:29                                 ` Emanuel Berg
2023-08-20  5:09                                   ` Ihor Radchenko
2023-08-20  6:51                                     ` Emanuel Berg
2023-08-20  7:14                                       ` Ihor Radchenko
2023-08-20  8:28                                         ` Alfred M. Szmidt
2023-08-20  9:29                                           ` Emanuel Berg
2023-08-20 15:22                                             ` Alfred M. Szmidt
2023-08-20 15:36                                               ` Ihor Radchenko
2023-08-20 15:45                                                 ` Eli Zaretskii
2023-08-20 15:54                                                   ` Ihor Radchenko
2023-08-20 16:29                                                     ` Alfred M. Szmidt
2023-08-20 16:37                                                       ` Ihor Radchenko
2023-08-20 17:19                                                         ` Alfred M. Szmidt
2023-08-20 17:31                                                           ` Ihor Radchenko
2023-08-20 18:54                                                             ` Alfred M. Szmidt
2023-08-20 19:15                                                               ` Ihor Radchenko
2023-08-20 19:24                                                                 ` Ihor Radchenko
2023-08-21  2:33                                                                   ` Eli Zaretskii
2023-08-21  4:11                                                                     ` Ihor Radchenko
2023-08-21  4:15                                                                       ` Po Lu
2023-08-21  4:36                                                                         ` Ihor Radchenko
2023-08-21  4:43                                                                           ` Po Lu
2023-08-21  5:06                                                                             ` Ihor Radchenko
2023-08-21  5:25                                                                               ` [External] : " Drew Adams
2023-08-20 21:51                                       ` Drew Adams

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