emacs-devel
[Top][All Lists]
Advanced

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

Re: defsubst VS defun or defmacro [was RE: Compiled code in Emacs-26 wil


From: raman
Subject: Re: defsubst VS defun or defmacro [was RE: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase]
Date: Thu, 23 Feb 2017 19:51:56 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Tino Calancha <address@hidden> writes:

:-) Emacspeak is probably one of the largest users of advice, so yes, I
know that particular downside.

The core of emacspeak uses defsubst in a number of places for speed ---
admittedly that was for speed in 1995, so it may well not be needed any
more.

I actually tried to change all defuns to defsubsts en-masse earlier
today -- but it broke things in strange and inexplicable ways  that
meant I had to revert that change.

I had never dug too deeply into this in emacs --- and my thought
initially after seeing the breakage in 26 was to say "just change all
defsubsts to defun " -- wish things were that simple.

> On Thu, 23 Feb 2017, T.V Raman wrote:
>
>> Please separate your personal opinion from fact. And asserting that
>> using defsubst is "misguided "  is not a useful way of carrying on a
>> conversation.
>>
>> Drew Adams writes:
>> > > Really? What should we be using, and when was defsubst deprecated?
>> > > defun or defmacro
>> > It has not been deprecated.
>> > I was expressing my opinion: It's rarely, if ever, needed,
>> > and misguided uses of it instead of defun are bothersome.
>
> Hi Raman,
> I guess Drew meant that defsubst makes debugging harder.  It also 
> complicates advising.  I know he does extensively use of advising
> in his own libraries.
>
> The manual mention some disadvantages on using defsubst
> in `(elisp) inline functions':
>
> "Also, inline functions do not behave well with respect to debugging,
> tracing, and advising (*note Advising Functions::).  Since ease of
> debugging and the flexibility of redefining functions are important
> features of Emacs, you should not make a function inline, even if it’s
> small, unless its speed is really crucial, and you’ve timed the code to
> verify that using ‘defun’ actually has performance problems."
>
> I find worth to read the whole node.  I used to be confused about when
> to use (to not) defsubst.
>

-- 



reply via email to

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