gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] (random tester) Error in FUNCALL [or a callee]: Caught f


From: Camm Maguire
Subject: Re: [Gcl-devel] (random tester) Error in FUNCALL [or a callee]: Caught fatal error [memory may be damaged]
Date: 01 Dec 2003 12:51:21 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings, and thanks for the pointer!

Is the example below from the spec?  Why is *y* a special?  Shouldn't
that be *x*?  In general, do lisp programmers think of specials as
stack allocated globals which are restored on any possibly non-local
exit from the context frame establishing the binding?

Take care,

"Paul F. Dietz" <address@hidden> writes:

> Camm Maguire wrote:
> 
> > One day I'd really like your and others advice on some lisp
> > programming dos and donts.  In particular, I frequently don't
> > understand why global special variables are used in place of
> > explicitly passed arguments.  My understanding of the rules governing
> > lexical and dynamic binding are still a bit primitive, with the latter
> > in my mind basically being equivalent to protecting a body of code
> > with an assignment to a C global and a save of the original value on
> > entry, and a restore of the old value on exit.
> 
> 
> Special variables get used when the value of the variable rarely
> changes.  Parameters are used when the values change frequently.
> 
> One can combine the two styles by making a function's lambda
> parameter be a special variable:
> 
> (defun foo (x *y* z)
>     (declare (special *x*))  ;; a prior toplevel (declaim (special *x*))
>                           ;; would also work
>     ;; The 2nd value passed to FOO will become the value of a binding
>     ;; to the special variable *y* for the life of this call.
>     ...)
> 
>       Paul
> 
> 
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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