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

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

Re: sending function arguments to recursive function calls


From: Stefan Monnier
Subject: Re: sending function arguments to recursive function calls
Date: Wed, 08 May 2013 08:25:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>   (make-scale-adjuster 42)
>   --> #[nil "\301\302!!\207" [inc text-scale-adjust abs] 3 nil nil]
>   (make-scale-adjuster 33)
>   --> #[nil "\301\302!!\207" [inc text-scale-adjust abs] 3 nil nil]
>   (eq (make-scale-adjuster 42)
>       (make-scale-adjuster 33)) 
--> t

> Here when compiling the function the closure inside is compiled at the
> same time, and when calling the compiled function, the same closed
> function is returned.  (It is a little strange that they're eq, since

They're `eq' because you compiled them in dynamic-binding mode
(i.e. they won't work).

> A good trick is to wrap all your special^W dynamic variables in stars:
>     (defvar *dynamic-variable* 'dyn)

That's the Common-Lisp convention, but Elisp uses another convention,
which is to add a "package prefix" such as `mypackage-myvar'.


        Stefan




reply via email to

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