help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Defining functions within functions?


From: Marcin Borkowski
Subject: Re: Defining functions within functions?
Date: Wed, 25 May 2016 08:20:12 +0200
User-agent: mu4e 0.9.16; emacs 25.1.50.1

On 2016-05-24, at 23:56, Drew Adams <drew.adams@oracle.com> wrote:

>> And I wanted to use the former variant, but it struck me as not very
>> elegant.  As for the latter, I'm not sure I understand it exactly, but
>> I'll give it some thought.
>> 
>> For now, I decided to go with lambdas, but also to sprinkle the code
>> with comments.  Old-fashioned, but should do the jon in my case.
>
> A suggestion: Post a concrete example of what you need, and
> see what concrete suggestions you get.
>
> Typically, this stuff is not complicated.  The first thing
> to do, IMO, is to determine whether you really need/want to
> do something special/complicated.  Why do you think you want
> a nested defun or other form of local function definition?

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.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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