[Maxima] Functions may leak information about names(!) oflocalvariables.
fateman at cs.berkeley.edu
Thu Dec 28 09:46:22 CST 2006
> -----Original Message-----
> From: maxima-bounces at math.utexas.edu [mailto:maxima-
> bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh
> Sent: Thursday, December 28, 2006 7:08 AM
> To: fateman at cs.berkeley.edu
> Cc: maxima at math.utexas.edu
> Subject: Re: [Maxima] Functions may leak information about names(!)
> What you say is not true. Changing t to tt makes no difference!
You are right... I didn't try the whole example! I looked again...
What is happening is, locally the "s" is bound to "t",
But not the global "t", just the symbol t. When maxima tries to find the
properties of the symbol t, it looks inside your local scope and finds a
local t. This is Maxima's version of "dynamic scope". So when you do
All you are doing is t:t.
To avoid this "capture" some people use the trick you've mentioned, which is
to have local variables with unusual names. Lisp makes it possible to
generate truly unique names (via gensym -- no one else can use them); it's
harder to do with maxima.
There are other ways of messing up with dynamic scope, e.g. binding of
arguments in function calls can make trouble as well. This type of binding
is now considered to be more trouble than it is worth.
Common Lisp has the more usual scope rules (essentially inherited from
Algol-60). You can write programs in Common Lisp, too.
More information about the Maxima