From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: Suggested additional example to Emacs Lisp Manual: Variables: Let Date: Sun, 29 Jan 2017 11:20:37 -0800 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485727976 19072 195.159.176.226 (29 Jan 2017 22:12:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2017 22:12:56 +0000 (UTC) User-Agent: Gnus/5.130016 (Ma Gnus v0.16) Emacs/25.1.91 (darwin) Cc: emacs-devel@gnu.org To: ben rudgers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 29 23:12:51 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 1cXxiM-0004lu-4U for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2017 23:12:50 +0100 Original-Received: from localhost ([::1]:56965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXxiR-0000ph-Ju for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2017 17:12:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXxdY-0005G0-2l for emacs-devel@gnu.org; Sun, 29 Jan 2017 17:07:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXxdX-0003cw-6H for emacs-devel@gnu.org; Sun, 29 Jan 2017 17:07:52 -0500 Original-Received: from mail-qk0-x22a.google.com ([2607:f8b0:400d:c09::22a]:36351) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXxdX-0003cU-2s for emacs-devel@gnu.org; Sun, 29 Jan 2017 17:07:51 -0500 Original-Received: by mail-qk0-x22a.google.com with SMTP id 11so112658479qkl.3 for ; Sun, 29 Jan 2017 14:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:date:message-id:references :user-agent:mail-followup-to:mime-version; bh=y5USQL3nciv0Tb94X+h8tgPMXdYYoVLzzMaGQ22aGrw=; b=mVtQMTL/8yTOthdJ5jLduwDD8L7v5dc509mDVbmadmqaBGTh7LbMPOvzlqrOMOpoL0 fO+SNp2qtx0JBCKdaeZel1Xx062qv+5yNEzGnbJhZNDA73LXbRXYhusyAZIGtagfShFQ bZGmrg7DmLS93Vtfvq80kofIqmJVJG4ywl0By2ga//2hn1W+LJLA+yMm421n0tAXN5Rl T1AABC3Fi4pd2t9r154sO+g10Y6EHg3kAarh/m8tkpo4FXtbP2lw2fPm+lenNnskLIM+ 3ZNJtGQKOkc7jcE6Le2j7Bx430pqyj4O+di9T1NuGFDfHTk64m8Ak3B8fea4tCeoveSv JO+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:date:message-id :references:user-agent:mail-followup-to:mime-version; bh=y5USQL3nciv0Tb94X+h8tgPMXdYYoVLzzMaGQ22aGrw=; b=p/Jkzv5V9aiDYmfwKltIGCZMKHGCPE3i+MRXaZDhQxvJnRUkFA1yq+E2xzumEt1HsO 6xxTxCFTDKGIpL/ZZlsEwZMoHIF19Oh1e2ghG0dx1AG+5swDGXFxYwn7mOossJx9+k2o SKFLcyiUyk6GgtJ007H560R8yiD0mgQ3wNsKynsJAkFlYMfcSi705+n2Xzo2DpnsflLb 1X/utJIInN+ZUa45n3CECV+n7+nJI9sVyiOYHbn0rl+6v8eC9IbDeMkACMSwYmysMSA1 T1hk+Cb6DyFJfTVgb2cRzyI1CG4IPg9btM11Nz/dLTRjRH1Y4ua90Q1Dduf/ued2NG9D rKoQ== X-Gm-Message-State: AIkVDXKE/kRxMFImuUMA6utEOJLvQtJIYF1qvvtuF6BCVjRtrPGMwczkqAFjQMwS1+uszg== X-Received: by 10.55.214.152 with SMTP id p24mr18477591qkl.223.1485727670643; Sun, 29 Jan 2017 14:07:50 -0800 (PST) Original-Received: from Hermes.local (125.sub-174-192-22.myvzw.com. [174.192.22.125]) by smtp.gmail.com with ESMTPSA id 83sm10375692qky.43.2017.01.29.14.07.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Jan 2017 14:07:47 -0800 (PST) X-Google-Original-From: "John Wiegley" Original-Received: by Hermes.local (Postfix, from userid 501) id 11E1C85F2E4; Sun, 29 Jan 2017 17:07:29 -0500 (EST) In-Reply-To: (ben rudgers's message of "Tue, 17 Jan 2017 14:17:49 -0600") Mail-Followup-To: ben rudgers , emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::22a 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:211743 Archived-At: >>>>> "br" == ben rudgers writes: br> The manual does not provide an example showing a locally scoped function. br> Though the behavior can potentially be inferred from the documentation of br> functions, an example showing the relationship between =let= and =funcall= br> might be of practical help for someone who has not made a deep dive into br> the manual. I think it would be better to encourage the use of `cl-flet' or `cl-labels', as though macros are specifically intended for binding local function definitions, and will automatically handle whether the function should be a `lambda' or a `closure', depending on the setting of `lexical-binding'. Your approach may have merit in terms of pedagogy, but I'd prefer to nudge users toward more idiomatic usage from the beginning. @example (require 'cl-macs) (defun foo (x) (cl-flet ((bar (y) (+ x y))) (bar 3))) (foo 4) @result{} 7 @end example -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2