all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Defining functions within functions?
Date: Wed, 25 May 2016 04:36:16 -0400	[thread overview]
Message-ID: <jwva8je4jug.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: 87vb2264mb.fsf@mbork.pl

> The reason is simple: I have this long, almost 60-lines function, with
> three levels of lambdas nested.  (I'm using request.el, and I have to
> make two requests sequentially, so I have a callback inside a callback.
> I could probably use deferred or something, this is one of the ideas.)
> It's just pretty complicated, and changing anything in this code is
> a headache.  Also, edebugging is simpler with separate instrumentable
> defuns.

These kinds of callback codes are often described as "CPS-style code",
and in some cases a couple of macros can go a long way to hiding this
machinery and give the illusion of "plain old sequential code", reducing
the nesting madness.


        Stefan




  reply	other threads:[~2016-05-25  8:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23  5:13 Defining functions within functions? Marcin Borkowski
2016-05-23  5:34 ` Eric Abrahamsen
2016-05-24 21:28   ` Marcin Borkowski
2016-05-23 20:09 ` Michael Heerdegen
2016-05-24 21:31   ` Marcin Borkowski
2016-05-24 21:56     ` Drew Adams
2016-05-24 22:10       ` Carlos Konstanski
2016-05-25  6:21         ` Marcin Borkowski
     [not found]       ` <mailman.224.1464127813.1216.help-gnu-emacs@gnu.org>
2016-05-24 22:21         ` Emanuel Berg
2016-05-25  6:20       ` Marcin Borkowski
2016-05-25  8:36         ` Stefan Monnier [this message]
2016-05-25  8:43           ` Nicolas Petton
2016-05-25 19:30             ` Marcin Borkowski
2016-05-25  9:07           ` tomas
2016-05-25 15:41             ` Marcin Borkowski
2016-05-25 14:18         ` Drew Adams
2016-05-25 15:39           ` Marcin Borkowski
     [not found]           ` <mailman.255.1464190813.1216.help-gnu-emacs@gnu.org>
2016-05-26  7:52             ` Emanuel Berg
     [not found]     ` <mailman.223.1464127012.1216.help-gnu-emacs@gnu.org>
2016-05-24 22:17       ` Emanuel Berg
     [not found]   ` <mailman.222.1464125502.1216.help-gnu-emacs@gnu.org>
2016-05-24 21:46     ` Emanuel Berg
     [not found] ` <mailman.141.1464034180.1216.help-gnu-emacs@gnu.org>
2016-05-24  7:13   ` Emanuel Berg
2016-05-24 14:33     ` Barry Margolin
2016-05-24 15:43       ` Emanuel Berg
2016-05-24 16:15         ` Barry Margolin
2016-05-24 21:36           ` Emanuel Berg
     [not found] <mailman.94.1463980455.1216.help-gnu-emacs@gnu.org>
2016-05-23  7:47 ` Emanuel Berg

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwva8je4jug.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.