From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.help Subject: RE: [External] : Re: Closures in Emacs and their usage scenarios. Date: Thu, 30 Sep 2021 12:58:44 +0200 Message-ID: <87sfxmjpnf.fsf@logand.com> References: <87ilyjlxnn.fsf@logand.com> <87y27fjal0.fsf@logand.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11224"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: Drew Adams , Stefan Monnier , Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 30 13:01:57 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1mVtp7-0002iT-7x for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 30 Sep 2021 13:01:57 +0200 Original-Received: from localhost ([::1]:37670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVtp5-0001IW-Pv for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 30 Sep 2021 07:01:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVtmE-00011I-J2 for help-gnu-emacs@gnu.org; Thu, 30 Sep 2021 06:58:58 -0400 Original-Received: from logand.com ([37.48.87.44]:59002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVtmD-0005LK-13 for help-gnu-emacs@gnu.org; Thu, 30 Sep 2021 06:58:58 -0400 Original-Received: by logand.com (Postfix, from userid 1001) id 0ACEF19EB31; Thu, 30 Sep 2021 12:58:46 +0200 (CEST) X-Mailer: emacs 27.2 (via feedmail 11-beta-1 I) In-Reply-To: Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com 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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133423 Archived-At: On Wed 29 Sep 2021 at 22:25, Drew Adams wrote: >> closures and dynamic binding does not go together well. > > Why do you say that? Can you point to a problem, > say, with Common Lisp, which was designed to have > both since its inception? Maybe I should have been more precise. There is no problem with Common Lisp it this regard. Common Lisp has lexical binding. Emacs Lisp did not have lexical binding until recently. Dynamic variables are not closed over so you cannot create a closure if your lisp does not have lexical binding. There are still such lisps that do support dynamic bindings only. Try to create a closure in such Lisp and see the workarounds. The point I was trying to make, that closures might not be used much in Emacs Lisp so far, because lexical binding is rather new there, not because there are a few use-cases.