[Maxima] [Maxima-commits] Maxima, A Computer Algebra System branch master updated. branch-5_27-base-72-g5287650
toy.raymond at gmail.com
Thu May 31 21:12:07 CDT 2012
On 5/30/12 7:37 AM, Douglas Crosher wrote:
> On 05/27/2012 05:03 AM, Robert Dodier wrote:
>> On 2012-05-24, Raymond Toy <toy.raymond at gmail.com> wrote:
>> For what it's worth, I don't have any problem with replacing DECLARE-TOP
>> with local DECLARE's. It would be tedious, that's all.
>>> Definitely agree with getting rid of the unspecial stuff. That should be
>>> fairly straightforward since those are obviously intended to be special
>>> only for that part of the file. The question is if you really want to put
>>> a (declare (special foo)) everywhere it's needed.
>> Well, the unspecial stuff indicates a local scope is intended. How about
>> if stuff between special/unspecial is wrapped in a lexical block
>> instead? E.g. replace
>> (declare-top (special foo bar))
>> (defun f ...)
>> (defun g ...)
>> (declare-top (unspecial foo bar))
>> (let (foo bar)
>> (declare (special foo bar))
>> (defun f ...)
>> (defun g ...))
>> What do you think?
> A syntactic convention could also resolve this problem as the special variables would be renamed from 'foo to '*foo* so 'unspecial
> would no long be needed. Many people prefer this style and perhaps it's worth considering.
> Further, when these special variables are used only within the context of some entry points and are not needed to hold state between
> calls then binding them at these entry points may make this use clear. For such use, using (declaim (special *foo* *bar*)) may be
> most appropriate.
I like this approach. It's a lot more work than Robert's approach, but
it has the nice side-effect that you have to kind of look and understand
at least a little about how the special variables are being used and
whether it's not just an accident that the same name is used.
Some variables I'd really like to rename are var, expr, ll, and ul.
These are used all over so it's nice to highlight their specialness.
But since they're used all over it's really hard to know if they really
are intended to be special or not. Perhaps it doesn't matter because
they are today, but that depends on the order in which the files are
compiled and loaded.
More information about the Maxima