From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen 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 20:20:21 -0800 Message-ID: <87bmtsfce2.fsf@pellet> 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> <87mvdcfffg.fsf@pellet> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1487910097 29768 195.159.176.226 (24 Feb 2017 04:21:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 24 Feb 2017 04:21:37 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 24 05:21:34 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 1ch7Nr-00077A-A7 for ged-emacs-devel@m.gmane.org; Fri, 24 Feb 2017 05:21:31 +0100 Original-Received: from localhost ([::1]:34553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch7Nw-0002JK-Pw for ged-emacs-devel@m.gmane.org; Thu, 23 Feb 2017 23:21:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch7N4-0002Hp-56 for emacs-devel@gnu.org; Thu, 23 Feb 2017 23:20:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ch7N1-0005Nk-2R for emacs-devel@gnu.org; Thu, 23 Feb 2017 23:20:42 -0500 Original-Received: from [195.159.176.226] (port=44767 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ch7N0-0005NX-RX for emacs-devel@gnu.org; Thu, 23 Feb 2017 23:20:38 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ch7Mp-0000mt-Cx for emacs-devel@gnu.org; Fri, 24 Feb 2017 05:20:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 28 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:lhEOVGfXW1r/uP8vipwX/4A7eg8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:212563 Archived-At: raman writes: > The rule of thumb I've used over the years: > > 1. Never use defmacro except when creating a special-form or special > notation AKA DSL > > 2. Use defun except for short and often repeated forms that also need > speed, then I've used defsubst because they behave like functions for > all practical purposes such as mapcar. Good, these were the principles I was working from, though in my case I had no empirical data to support them :) > 3. I had done some timing in the early days of emacspeak, including > looking at what M-x disassemble produced, then tighten the inner loop of > emacspeak appropriately with defsubst. > > 4. What just broke is calls to defsubst-defined functions from within > other defsubst --- independent of our various views on the misguidedness > or otherwise of defsubst, I believe this is a bug that might be worth > fixing since it breaks working code in mysterious and unpredictable ways. Okay, makes sense. I've never been tempted to use defsubsts for anything more than two-liners, but I'll keep an eye on this. Thanks! Eric