|
From: | Tino Calancha |
Subject: | defsubst VS defun or defmacro [was RE: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase] |
Date: | Fri, 24 Feb 2017 11:06:53 +0900 (JST) |
User-agent: | Alpine 2.20 (DEB 67 2015-01-07) |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |