From: John Wiegley <jwiegley@gmail.com>
To: ben rudgers <ben.rudgers@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Suggested additional example to Emacs Lisp Manual: Variables: Let
Date: Sun, 29 Jan 2017 11:20:37 -0800 [thread overview]
Message-ID: <m2k29d4qre.fsf@newartisans.com> (raw)
In-Reply-To: <CAKmb-ygZK=9phsyzvnd2GrMO4jppyCSyNdSSPM_q9RY_0aeiag@mail.gmail.com> (ben rudgers's message of "Tue, 17 Jan 2017 14:17:49 -0600")
>>>>> "br" == ben rudgers <ben.rudgers@gmail.com> 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
next prev parent reply other threads:[~2017-01-29 19:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 20:17 Suggested additional example to Emacs Lisp Manual: Variables: Let ben rudgers
2017-01-29 19:20 ` John Wiegley [this message]
2017-01-30 4:53 ` ben rudgers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2k29d4qre.fsf@newartisans.com \
--to=jwiegley@gmail.com \
--cc=ben.rudgers@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).