Subject: Local variables not so local within block
From: Richard Fateman
Date: Tue, 24 Jul 2012 14:10:49 -0700
In my view, a major DISadvantage of making function names lexical in
scope is
that it becomes impossible, in that model of execution, to trace them.
Those
names are simply not visible at the top level and so trace (foo) has no
effect on calls to foo, if foo is local to some [lexical] block.
I am not arguing against the information-hiding advantages in merging
multiple
packages, but to some extent that can be simulated by using uniquely
prefixed names.
People already tend to do this.
Also, if you want to keep all information "lexical", there may be more
work to do.
Syntax extensions can conflict, in different packages.
Other properties, like gradef are presumably placed on global property
lists.
Some programs rely on the fact that flags (like ratprint or fpprec) are
dynamically bound.
The merging of "mathematical semantics" and "programming semantics" that is
inherent in a computer algebra system is not something that is
necessarily solved
by saying
"we are using programming language lexical scope".
Just because people familiar with programming languages tend to be in the
driver's seat on implementation, does not mean they know where to drive.
RJF
On 7/24/2012 1:53 PM, Robert Dodier wrote:
> Stefano Ferri <ferriste <at> gmail.com> writes:
>
>> Just tried some more complex code... I think it is not safe to
>> substitute all blocks with blex now... For example, it makes a
>> local prederror:true statement not working.
> blex([a, b, c], ...) makes a, b, and c lexical variables, and
> so it's not surprising blex([prederror:true], ...) has an unexpected
> effect: prederror must be a non-lexical variable to get the
> effect you want.
>
> There is a little bit of fossil code for a declare(x, special)
> declaration -- if lexical variables come to pass, we might want
> to revive that.
>
> Thanks for your interest -- if anyone else cares to comment,
> I would be interested to hear about it. I am fairly naive about
> the problems involved so I'd appreciate any guidance.
>
> best
>
> Robert Dodier
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima