From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Lexical byte-compilation warnings cleanup Date: Wed, 21 Aug 2013 00:49:22 -0400 Message-ID: References: <5cd4c948-8187-4901-8c17-1db4c7288fe7@default> <6daf4da3-1d3a-4f4c-9db8-7174fb6da584@default> <87wqnfg675.fsf@uwakimon.sk.tsukuba.ac.jp> <9c9d5439-3ef5-44a3-b886-bc95bddec03a@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1377060581 26949 80.91.229.3 (21 Aug 2013 04:49:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Aug 2013 04:49:41 +0000 (UTC) Cc: "Stephen J. Turnbull" , Daniel Hackney , Emacs development discussions To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 21 06:49:42 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VC0MY-0002M2-7S for ged-emacs-devel@m.gmane.org; Wed, 21 Aug 2013 06:49:42 +0200 Original-Received: from localhost ([::1]:51439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC0MX-0006Fn-Nm for ged-emacs-devel@m.gmane.org; Wed, 21 Aug 2013 00:49:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC0MN-0006F5-TQ for emacs-devel@gnu.org; Wed, 21 Aug 2013 00:49:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VC0MG-0005Fd-8A for emacs-devel@gnu.org; Wed, 21 Aug 2013 00:49:31 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:54671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC0MG-0005FO-47 for emacs-devel@gnu.org; Wed, 21 Aug 2013 00:49:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFHO+LNT/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAs0EhQYDSSIHgazMI19kQoDpHqBXoJqKQ X-IPAS-Result: Av4EABK/CFHO+LNT/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAs0EhQYDSSIHgazMI19kQoDpHqBXoJqKQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="22724832" Original-Received: from 206-248-179-83.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.179.83]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 Aug 2013 00:49:16 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id D7D79AE1E2; Wed, 21 Aug 2013 00:49:22 -0400 (EDT) In-Reply-To: <9c9d5439-3ef5-44a3-b886-bc95bddec03a@default> (Drew Adams's message of "Tue, 20 Aug 2013 19:57:49 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162947 Archived-At: >> > And the intention is? The design is? The reason is? Check the calling convention used by the new byte-code representation (used for lexically scoped code) and you'll see that there's no support for dynamic scoping in it. Adding such support "natively" would slow down the common case too much. We could support dynamically-scoped args in lexically-scoped byte-code by tweaking the byte-compiler, but then the byte-code that the byte-compiler needs to generate is the same as the one you get with: (defun foo (lexarg) (let ((dynvar lexarg)) ...)) So I prefer to make the extra cost of the separate `let' binding explicit in the source code. Especially since it has various beneficial side-effects: - simpler byte-compiler. - slightly more efficient handling of function calls for lexically-scoped interpreted code (this is actually less beneficial than I thought at first, tho). - IMNHO better style (I have always found it confusing when dynvars were bound as function arguments rather than by a let-binding). - having a separate `let' often allows you to move it to a better place, and/or to add useful code between the function header and the let binding (such as the defvar that causes the variable to be dynamically bound). BTW, I have never seen a dynamically-scoped argument used in Common Lisp. Stefan