emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SUSPECTED SPAM] Re: [Emacs-diffs] scratch/widen-less a4ba846: Repla


From: John Wiegley
Subject: Re: [SUSPECTED SPAM] Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls
Date: Wed, 20 Dec 2017 17:33:51 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (darwin)

>>>>> "DG" == Dmitry Gutov <address@hidden> writes:

DG> FWIW, I'm told define-inline is a better choice these days.

Hmm... no docstring, although it's in the Elisp ref manual. Quoting from
there:

   Functions defined via ‘define-inline’ have several advantages with
   respect to macros defined by ‘defsubst’ or ‘defmacro’:

   − They can be passed to ‘mapcar’ (*note Mapping Functions::).
   − They are more efficient.
   − They can be used as “place forms” to store values (*note
     Generalized Variables::).
   − They behave in a more predictable way than ‘cl-defsubst’ (*note
     (cl)Argument Lists::).

So, yeah. And I wouldn't really call using define-inline instead of defun for
tiny functions "premature optimization" in cases like these. You're not
changing the semantics of the function, just indicating it's small enough that
it should be inlined when byte-compiling. And you know the number of call
sites too, so it won't cause code bloat. When it's that harmless, I usually do
it as a matter of convention in my own code.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]