On 1/17/12, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> Not sure what lexical scope in the Maxima language (call it MaximaL) has to
> do with lexical scope in the implementation Lisp, call it MaxLisp (which
> was the original issue).
Well, of course there is no necessary connection.
But the one topic seems to lead to the other.
> Both MaximaL and MaxLisp use a variety of global variables to control the
> behavior of various functions. Things like $simp, $algebraic, $gcd,
> $fpprec, $ratvars, etc. It is a common idiom to write
> block([algebraic:false], ...) or its equivalent in Lisp. This is ugly and
> error-prone, but very convenient, and pretty common.
Yup.
> Of course, you could always have some way of exempting
> some variables (declare them "dynamic")
> but then you're back to the original problem of lack of referential
> transparency.
Well, would it be OK if such "unlexical" declarations were local
in effect? The bug we ran into with LB stems from the unbounded
scope of PROCLAIM ....
> This is without addressing the question of the interpretation of symbolic
> variables. For example, what is the value of block([x],x)-x? Is it 0? Or
> is the inner x a different symbolic variable?
Well, to be consistent, wouldn't we have to say that the inner x
is a different symbol, and therefore the result will look like x - x ?
I agree that would be puzzling to users, but consistency is less puzzling
in the long run, I hope.
best
Robert Dodier