From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: named-let Date: Tue, 12 Jan 2021 09:24:46 +0000 Message-ID: References: <87im86kub6.fsf@logand.com> <86zh1g62zx.fsf@163.com> <875z4385yd.fsf@logand.com> Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18639"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Zhu Zihao , Tomas Hlavaty , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 12 10:27:04 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzFx8-0004iH-Q6 for ged-emacs-devel@m.gmane-mx.org; Tue, 12 Jan 2021 10:27:02 +0100 Original-Received: from localhost ([::1]:56454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzFx7-0005kQ-Sr for ged-emacs-devel@m.gmane-mx.org; Tue, 12 Jan 2021 04:27:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzFvH-0004Z2-Bz for emacs-devel@gnu.org; Tue, 12 Jan 2021 04:25:07 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:57086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzFvE-0001eO-UQ for emacs-devel@gnu.org; Tue, 12 Jan 2021 04:25:07 -0500 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTP id 10C9OkEO022394; Tue, 12 Jan 2021 09:24:47 GMT In-Reply-To: (Stefan Monnier's message of "Mon, 11 Jan 2021 18:57:36 -0500") Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:262962 Archived-At: Stefan Monnier writes: >>> [ TCO has also undesirable interactions with debugging/tracing, but >>> I think that would be a secondary concern which should be >>> manageable somehow. ] >> >> It's also a change in semantic as one must assume that `bar' is not >> redefining `foo'. >> >> (defun foo () >> (bar) >> (foo)) > > I think there's a bit of confusion: you can have TCO without having to > pay any attention to whether `bar` changes `foo`. True TCO will also > avoid eating up stack space when you have code like Yes, I was discussing Tail Recursion Eliminination (or self TCO). Actually I was thinking one could even check if `foo' was redefined before performing the TRE sequence (well I guess that's what the byteinterpreter patches you've mentioned did), in this case we could have it also at speed 2. As a side note I think we could have full TCO in Emacs, but at the cost of a relatively invasive patch and a some (probably small but hard to quantify a priori) performance regression. Not sure it is sufficiently important to justify that. Andrea