On Sun, Aug 10, 2014 at 5:24 AM, <maxima-discuss-request@lists.sourceforge.net> wrote:
I think that all Maxima declarations and assumptions are global.
That is, when you say declare(n,constant),  ALL stack bindings
  are ignored.  Why?  because only name-value pairs are eligible for
binding locally.
There is a declaration  local()  which provides an opportunity to bind
name-function pairs.

We could consider whether this is optimal or should be changed ...

(a) technical standpoint (supporting programmers)
(b) easiest to explain / principle of least surprise for users
(c) not breaking existing code
(d) fixing apparently surprising "features" -- later revealed to be more
like bugs.
(e) other criteria?

At the moment (d)  seems to push us in the direction of allowing
constants to be bound.

It  would be possible to change meval and friends to do lexical scoping,
or a flag
which makes the change.  Some years ago Maple did a revision (or a
and changed its scoping.   I think it is a credit to the generally
shallow programming
in these systems that for a huge majority of the existing code, it
doesn't matter.

A programmer deeply into Scheme probably would write programs where it
does matter.


I would like to second RJF's opinion on global space assignment of all declaration,assumptions and rules and functions.

a) The idea that maxima could offer to resolve is using "context". In documentation there are references to subcontexts but nothing about how they are used from the parent context.​
creating a "supcontext" doesn't add facts() from both into one.

b) Also there is no information if some variable could be used from another context using some fully qualified name.

c)properties(function_name) shall also list the context it is relevant to. Means even functions could be categorized. 

d) This feature is also important in case someone wants to divide somewhat similar rules into multiple containers(contexts). Otherwise a person has to write lot of predicates to differentiate all similar lhs rules from others.

e) Another use case, one can add frequently used rules to a subcontext​ and search first in it, as in Rete's algo in term rewriting systems. Its useful only if list of rules is exceptionally long.

f) A temporary context could be used that will be killed automatically once the task is achieved.

There can be many more uses of this interaction of contexts.

Pankaj Sejwal
"The more I read, the more I acquire, the more certain I am that I know nothing.” -