From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: raman Newsgroups: gmane.emacs.devel 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 Message-ID: References: <1b07c68a-873e-83c8-246d-423bc83a3881@gmail.com> <83y3xg4ldw.fsf@gnu.org> <22703.8413.359650.67917@retriever.mtv.corp.google.com> <22703.10479.123157.339839@retriever.mtv.corp.google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1487908395 2984 195.159.176.226 (24 Feb 2017 03:53:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 24 Feb 2017 03:53:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: cpitclaudel@gmail.com, vibhavp@gmail.com, Emacs developers , monnier@iro.umontreal.ca, eliz@gnu.org, Drew Adams To: Tino Calancha Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 24 04:53:11 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ch6wM-0008AS-Su for ged-emacs-devel@m.gmane.org; Fri, 24 Feb 2017 04:53:07 +0100 Original-Received: from localhost ([::1]:34483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch6wS-0007Kf-Hb for ged-emacs-devel@m.gmane.org; Thu, 23 Feb 2017 22:53:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch6vL-0006vg-NB for emacs-devel@gnu.org; Thu, 23 Feb 2017 22:52:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ch6vI-00067U-Lc for emacs-devel@gnu.org; Thu, 23 Feb 2017 22:52:03 -0500 Original-Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]:35126) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ch6vI-00067K-Eo for emacs-devel@gnu.org; Thu, 23 Feb 2017 22:52:00 -0500 Original-Received: by mail-pf0-x231.google.com with SMTP id 68so1028660pfx.2 for ; Thu, 23 Feb 2017 19:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=qCb2AbjZSch8gEj8D3rRo5k7gaIfoJRnUfdudd6KiAI=; b=GsER+60XtqRCvVyCOcJHP/l8RMJHenj8knoB49LIlM3sfB4VrJEB7arbKqlgjDOO32 X7Sy+UOEKDHbvnRvqo0WI3WBAqe4NdUyxw9E56Miv6V1TtUN/JJJdxiPylsXpJKxfYhg qSZ+MdnEo2IaVqEYkc0Kow9QQT+NCOwBDQp5vNjXg59xbgSe1jMvtewaV3dHvWBTNolY eP0AGpGiAKD9p/mEfDB05rBw3CkjbD4uaFuL6DDW7MpOGtPmzaQa18mIvynoVSEVKJq1 snJ/dQHNlY5VnI8sZhTZXG8snmp5CjShYLNbF0gnYA8IyvWpZYAAL5ioTkfkRp8UYybO cYpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=qCb2AbjZSch8gEj8D3rRo5k7gaIfoJRnUfdudd6KiAI=; b=jNlG/w1nZXh1JEHxrLK/Rzh0NE9wMaiALtGvQkBz7buTvo+E/9YgpjfAoOHgmVHxIG p7RlUZRRdLwAzxE8kpxBV34frT2cA0o3NnREUQwBQeOrw7YD3JrpQ71GuauKHN8D9HGk mqIhfqKHaOCxEWav5HSKehXoRkrrWa995oA81GRsgfiygDoleO5XZcPmOyMn1BH7UGfx Gz9c0n+RhpdzfHyvppQIR5PB3y4+t165M5WJGkZXJBZQT6IdIwyLsclo6fSDFeSgajxi JzA2fg/yFyHIgOqT4Ik3fBXpANBlU8YNIMpXRArDu8EwgxHoYHRT1kKVpu956ZI+DGzE udJQ== X-Gm-Message-State: AMke39mch/04VvXagSdFR8Yu3q0FTN36nF1Zf8DUUeH8ng5VCc8CgF25jhdOMforqPsbmQFP X-Received: by 10.98.89.195 with SMTP id k64mr851203pfj.126.1487908319189; Thu, 23 Feb 2017 19:51:59 -0800 (PST) Original-Received: from raman-glaptop2 (c-73-170-121-60.hsd1.ca.comcast.net. [73.170.121.60]) by smtp.gmail.com with ESMTPSA id s26sm12280709pge.33.2017.02.23.19.51.57 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 23 Feb 2017 19:51:58 -0800 (PST) In-Reply-To: (Tino Calancha's message of "Fri, 24 Feb 2017 11:06:53 +0900 (JST)") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212560 Archived-At: Tino Calancha 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=20 > 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=A1= =AFs > small, unless its speed is really crucial, and you=A1=AFve timed the code= to > verify that using =A1=AEdefun=A1=AF actually has performance problems." > > I find worth to read the whole node. I used to be confused about when > to use (to not) defsubst. > --=20