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.devel Subject: Re: Naming FCRs Date: Thu, 30 Dec 2021 11:15:17 +0100 Message-ID: <87ilv6bdqi.fsf@logand.com> References: <01d516b3-86ca-fdf3-73f0-49b2e6930499@gmail.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="25951"; mail-complaints-to="usenet@ciao.gmane.io" To: tomas@tuxteam.de, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 30 11:16:40 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 1n2sUC-0006VV-P8 for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Dec 2021 11:16:40 +0100 Original-Received: from localhost ([::1]:57402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2sUB-0005KN-KL for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Dec 2021 05:16:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2sT4-00041W-CU for emacs-devel@gnu.org; Thu, 30 Dec 2021 05:15:30 -0500 Original-Received: from logand.com ([37.48.87.44]:55218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2sT2-0002qB-1E for emacs-devel@gnu.org; Thu, 30 Dec 2021 05:15:29 -0500 Original-Received: by logand.com (Postfix, from userid 1001) id 9DF6219EC85; Thu, 30 Dec 2021 11:15:18 +0100 (CET) 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: 0 X-Spam_score: -0.0 X-Spam_bar: / X-Spam_report: (-0.0 / 5.0 requ) SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:283635 Archived-At: On Thu 30 Dec 2021 at 09:43, wrote: > Possibly because it diverges somewhat from the canonical meaning of > "closure" -- it might confuse people. I don't think so. Lisps usually expose a way to see the closed over variables, so in reality, there is no such thing as "closures that don't permit access". You can do that in Emacs right now (maybe not portably across different compiler backends): ELISP> (defun foo (a b) (lambda (c) (+ a b c))) foo ELISP> (foo 3 5) (closure ((b . 5) (a . 3) t) (c) (+ a b c)) ELISP> (defun faz (a b) (lambda (c) (error "a=%d b=%d" a b))) faz ELISP> (setq baz (faz 3 5)) (closure ((b . 5) (a . 3) t) (c) (error "a=%d b=%d" a b)) ELISP> (funcall baz 13) *** Eval error *** a=3 b=5 ELISP> (setq debug-on-error t) t ELISP> (funcall baz 13) Debugger entered--Lisp error: (error "a=3 b=5") signal(error ("a=3 b=5")) error("a=%d b=%d" 3 5) (closure ((b . 5) (a . 3) t) (c) (error "a=%d b=%d" a b))(13) funcall((closure ((b . 5) (a . 3) t) (c) (error "a=%d b=%d" a b)) 13) eval((funcall baz 13) t) ielm-eval-input(#("(funcall baz 13)" 0 16 (fontified t)) nil) ielm-send-input(nil) ielm-return() funcall-interactively(ielm-return) call-interactively(ielm-return nil nil) command-execute(ielm-return) ELISP> (car baz) closure ELISP> (cdr (assoc 'a (cadr baz))) 3 (#o3, #x3, ?\C-c) ELISP> (rplacd (assoc 'a (cadr baz)) 42) 42 (#o52, #x2a, ?*) ELISP> baz (closure ((b . 5) (a . 42) t) (c) (error "a=%d b=%d" a b))