GNU bug report logs - #76294
`(cl-proclaim (inline foo))` vs `(defsubst foo ...)`

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Fri, 14 Feb 2025 22:31:02 UTC

Severity: wishlist

Done: Stefan Kangas <stefankangas <at> gmail.com>

To reply to this bug, email your comments to 76294 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org:
bug#76294; Package emacs. (Fri, 14 Feb 2025 22:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefankangas <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org. (Fri, 14 Feb 2025 22:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: `(cl-proclaim (inline foo))` vs `(defsubst foo ...)`
Date: Fri, 14 Feb 2025 22:29:47 +0000
[Message part 1 (text/plain, inline)]
Severity: wishlist

May I ask what is the value proposition of

    (defun foo () ...)
    (cl-proclaim '(inline foo))

over

    (defsubst foo () ...)

in Emacs Lisp code?

I assume that it won't be much help when porting code from CL, so I
guess it's just to make ELisp feel more homely to CL programmers?

If it is intended as documentation of cl-proclaim itself, I propose
improving the cl-proclaim documentation instead.  The docstring is
rather on the brief side, shall we say.

I'm asking because running into this in cl-lib.el made me start to
consider the below patch.  It's possible that I'm just the wrong person
to be digging around in cl-lib.el, though...
[0001-Avoid-cl-proclaim.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76294; Package emacs. (Fri, 14 Feb 2025 22:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 76294 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 76294 <at> debbugs.gnu.org,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#76294: `(cl-proclaim (inline foo))` vs `(defsubst foo ...)`
Date: Fri, 14 Feb 2025 17:52:38 -0500
> May I ask what is the value proposition of
>
>     (defun foo () ...)
>     (cl-proclaim '(inline foo))
>
> over
>
>     (defsubst foo () ...)
>
> in Emacs Lisp code?

I never dared to touch this because I know I'm biased against those
thingies.  IOW, I'd be happy to deprecate such usage.  🙂

> I'm asking because running into this in cl-lib.el made me start to
> consider the below patch.

Looks good to me.  I suspect the reason behind the current code might be
that `defsubst` was introduced after cl.el got (and used) `proclaim`.


        Stefan





Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Fri, 14 Feb 2025 23:51:01 GMT) Full text and rfc822 format available.

Notification sent to Stefan Kangas <stefankangas <at> gmail.com>:
bug acknowledged by developer. (Fri, 14 Feb 2025 23:51:02 GMT) Full text and rfc822 format available.

Message #13 received at 76294-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 76294-done <at> debbugs.gnu.org,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#76294: `(cl-proclaim (inline foo))` vs `(defsubst foo ...)`
Date: Fri, 14 Feb 2025 23:50:29 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> May I ask what is the value proposition of
>>
>>     (defun foo () ...)
>>     (cl-proclaim '(inline foo))
>>
>> over
>>
>>     (defsubst foo () ...)
>>
>> in Emacs Lisp code?
>
> I never dared to touch this because I know I'm biased against those
> thingies.  IOW, I'd be happy to deprecate such usage.  🙂

I probably won't get into deprecating it completely, to be honest.  Not
right now, at any rate.

>> I'm asking because running into this in cl-lib.el made me start to
>> consider the below patch.
>
> Looks good to me.  I suspect the reason behind the current code might be
> that `defsubst` was introduced after cl.el got (and used) `proclaim`.

Makes sense, thanks!

I think it's a good enough argument that the implementation itself
should make sense from an Emacs Lisp perspective, so I installed the
patch.  AFAICT, there is now exactly one use of `cl-proclaim` in all of
Emacs and GNU ELPA.  I didn't check NonGNU ELPA.

If anyone has anything relevant to add for posterity, please do.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76294; Package emacs. (Wed, 19 Feb 2025 01:00:06 GMT) Full text and rfc822 format available.

Message #16 received at 76294 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 76294 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#76294: `(cl-proclaim (inline foo))` vs `(defsubst foo ...)`
Date: Tue, 18 Feb 2025 19:59:10 -0500
[[[ 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. ]]]

  > >> May I ask what is the value proposition of
  > >>
  > >>     (defun foo () ...)
  > >>     (cl-proclaim '(inline foo))
  > >>
  > >> over
  > >>
  > >>     (defsubst foo () ...)
  > >>
  > >> in Emacs Lisp code?
  > >
  > > I never dared to touch this because I know I'm biased against those
  > > thingies.  IOW, I'd be happy to deprecate such usage.  🙂

The message starts by comparing two constructs.
Which of the two are you proposing to deprecate?

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






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76294; Package emacs. (Wed, 19 Feb 2025 23:21:02 GMT) Full text and rfc822 format available.

Message #19 received at 76294 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: rms <at> gnu.org
Cc: 76294 <at> debbugs.gnu.org
Subject: Re: bug#76294: `(cl-proclaim (inline foo))` vs `(defsubst foo ...)`
Date: Wed, 19 Feb 2025 15:20:25 -0800
Richard Stallman <rms <at> 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. ]]]
>
>   > >> May I ask what is the value proposition of
>   > >>
>   > >>     (defun foo () ...)
>   > >>     (cl-proclaim '(inline foo))
>   > >>
>   > >> over
>   > >>
>   > >>     (defsubst foo () ...)
>   > >>
>   > >> in Emacs Lisp code?
>   > >
>   > > I never dared to touch this because I know I'm biased against those
>   > > thingies.  IOW, I'd be happy to deprecate such usage.  🙂
>
> The message starts by comparing two constructs.
> Which of the two are you proposing to deprecate?

In this bug report, I have proposed deprecating neither.

We have discussed elsewhere to deprecate `cl-proclaim`.




This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.