[Maxima] [Maxima-commits] Maxima, A Computer Algebra System branch master updated. branch-5_27-base-72-g5287650
dtc-maxima at scieneer.com
Wed May 30 09:37:05 CDT 2012
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
When these variables hold state between calls then perhaps they should be recognised for holding the working state by defining a new
macros like 'defvar such as 'def-maxima-state-var or just 'maxima:defsvar. Knowing the variables that hold the working state could
be useful for saving and restoring the state and perhaps in further for multi-threaded code working with different state.
More information about the Maxima