Well, for the purpose of testing the performance impact of being able to declare "unspecial", I hacked into ABCL an UNDEFVAR primitive function and adjusted lmdcls.lisp accordingly.
The change takes ABCL from ~3300 seconds to ~ 2020 seconds evaluation time for Maxima's test suite.
Wow, that's great.
It looks to me like - although I agree with you about the archaic nature of it - that Maxima would greatly benefit from (at least with ABCL) specials to be defined more locally: it's more Common Lisp if it does.
Agreed.
About unspecial versus dropping specials automatically at the end of file, I don't have a strong preference, but I am leaning towards automatically dropping them.
Ok. I tried a different strategy: I've made (in my local copy) "local" special bindings available for direct manipulation, instead of through the functional interface (which does a lookup, every time). The result was somewhat disappointing: without the "unspecial" stuff, it shaves off only 200 seconds (out of 3300); meaning roughly 7% savings.
When I apply the "unspecial" patch (also locally), the additional special bindings change doesn't even make a difference (only a few seconds evaluation time difference with the version without).
I can't tell if Maxima expects specials to be carried over from one file to the next; some code might be written assuming they are, but some other code might be written assuming they are not. Be that as it may, I'm pretty sure the unspecial declaration works for only a few Lisps (for the others it's just a no-op iirc).
I wonder what other Lisps do.
So do I, really.
In ABCL, it's a fair amount of work to "unbind" a special (reverse established special bindings); it's possible other lisps have less work to do in that respect.
Bye,
Erik.