From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: sending function arguments to recursive function calls
Date: Tue, 07 May 2013 16:32:50 +0200 [thread overview]
Message-ID: <87d2t2uagd.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: CAM8gEgiYooxNWNNtVPi3HrtRp6VTrZZ5HccNrX4mCAsOLi7zDA@mail.gmail.com
Gauthier Östervall <gauthier@ostervall.se> writes:
> On Sat, May 4, 2013 at 5:30 PM, Drew Adams <drew.adams@oracle.com> wrote:
>> The key to the puzzle is this little declaration in the first comment of the
>> file:
>>
>> ;;; face-remap.el --- Functions for ... -*- lexical-binding: t -*-
>>
>> That `lexical-binding t' tells Emacs that the code in this file is meant to be
>> understood with the variable `lexical-binding' bound to t (locally).
>
> Thanks for the kind words and the explanation. I do not feel very
> confident about having a function that relies on a file scope setting
> of lexical-binding, which as in this case happens 300 lines earlier.
> Wouldn't it be better to have functions that work whatever the value
> of lexical-binding, if possible?
>
>> An alternative to using a lexical binding here would be to simply use this:
>>
>> `(lambda () (interactive) (text-scale-adjust (abs ',inc)))
>
> If this alternative works whatever lexical-binding, it seems superior
> to me. Isn't it?
No, it is inferior.
Here, you have to duplicate the code of the function for each occurence.
With closures (lexical binding) you only need to duplicate the enclosed
environment, the code of the function being the same for all the
closures.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
next prev parent reply other threads:[~2013-05-07 14:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-04 13:01 sending function arguments to recursive function calls Gauthier Östervall
2013-05-04 15:30 ` Drew Adams
2013-05-07 11:25 ` Gauthier Östervall
2013-05-07 14:04 ` Drew Adams
2013-05-08 12:21 ` Stefan Monnier
2013-05-09 8:35 ` Gauthier Östervall
2013-05-09 12:23 ` Stefan Monnier
2013-05-12 13:19 ` Gauthier Östervall
2013-05-13 14:55 ` Stefan Monnier
2013-05-17 12:20 ` Gauthier Östervall
2013-05-17 12:26 ` Dmitry Gutov
2013-05-17 14:31 ` Drew Adams
2013-05-19 16:57 ` Dmitry Gutov
2013-05-21 16:34 ` Drew Adams
[not found] ` <mailman.70.1368982677.22516.help-gnu-emacs@gnu.org>
2013-05-19 20:59 ` Pascal J. Bourguignon
2013-05-20 19:31 ` Dmitry Gutov
[not found] ` <mailman.94.1369078320.22516.help-gnu-emacs@gnu.org>
2013-05-20 19:55 ` Pascal J. Bourguignon
2013-05-07 14:32 ` Pascal J. Bourguignon [this message]
[not found] ` <mailman.25279.1367935468.855.help-gnu-emacs@gnu.org>
2013-05-07 14:55 ` Pascal J. Bourguignon
2013-05-08 12:25 ` Stefan Monnier
2013-05-05 1:22 ` Stefan Monnier
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=87d2t2uagd.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@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.
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).