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>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#76294: closed (`(cl-proclaim (inline foo))` vs `(defsubst foo
 ...)`)
Date: Fri, 14 Feb 2025 23:51:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 14 Feb 2025 23:50:29 +0000
with message-id <CADwFkm=XwtVT=Fk1OvXPm4VuPQNRSdq_Np0QvUVG9wCxoL=HXg <at> mail.gmail.com>
and subject line Re: bug#76294: `(cl-proclaim (inline foo))` vs `(defsubst foo ...)`
has caused the debbugs.gnu.org bug report #76294,
regarding `(cl-proclaim (inline foo))` vs `(defsubst foo ...)`
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
76294: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76294
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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 3 (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)]
[Message part 5 (message/rfc822, inline)]
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.


This bug report was last modified 115 days ago.

Previous Next


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