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: Emanuel Berg
Subject: Re: Defining functions within functions?
Date: Tue, 24 May 2016 23:36:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Barry Margolin <barmar@alum.mit.edu> writes:

>> "reassign the variable"?
>
> (defun foo-local (a) 
>   (flet ((bar ()
>            (incf a)))
>     (bar))
>   a)
>
> vs.
>
> (defun foo-global (a)
>   (setq a (bar a))
>   a)
> (defun bar (a)
>   (+1 a))

OK, so it is a situation with global variables?

Personally I never (?) use `setq' in defuns so
again this situation is hard to visualize in an
applied setting, but yes, I see
the reassignment.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 40 Blogomatic articles -                   


reply via email to

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