[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Defining functions within functions?

From: Stefan Monnier
Subject: Re: Defining functions within functions?
Date: Wed, 25 May 2016 04:36:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]