1. I once implemented a more general mechanism for binding syntax variables around compilation, which must be part of the syntax-control branch (that probably needs a lot of love rebasing it on top of the latest ASDF). Syntax variables include *readtable*, *read-base*, *read-default-float-format*, etc., as well as any user-defined variables to similar purposes in user extensions.
2. However, note this only has guaranteed semantics if the effects of those variables are at read-time / macroexpansion-time / compile-time. Features such as linking (on ECL, MKCL) or fasl concatenation (on about every other platform) are incompatible with relying on effects from binding variables around individual lisp or fasl files. Of course, you could declare "my system and any system that depends on it is incompatible with linking and fasl concatenation".
3. As for having bindings around compiling individual files, there is already the around-compile hook, that you could use or override or define methods for, to bind variables around such compilation. You could use this interface, and make it more extensible if you want.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org “Those who cannot remember the past are condemned to repeat it.” — George Santayana
On Wed, Apr 24, 2024 at 4:51 AM Didier Verna didier@didierverna.net wrote:
François-René ÐVB Rideau écrivait:
What are the methods defined by asdf-flv?
In order to support file local variables, ASDF-FLV does this:
(defmethod asdf:perform :around ((operation asdf:load-op) (file asdf:cl-source-file)) "Establish new dynamic bindings for file-local variables." (progv *file-local-variables* (mapcar #'symbol-value *file-local-variables*) (call-next-method)))
(defmethod asdf:perform :around ((operation asdf:compile-op) (file asdf:cl-source-file)) "Establish new dynamic bindings for file-local variables." (progv *file-local-variables* (mapcar #'symbol-value *file-local-variables*) (call-next-method)))
The problem, of course, is that loading ASDF-FLV will override any existing method with the same signature, and conversely, anything else loaded afterward will override ASDF-FLV.
ASDF-FLV could subclass ASDF:CL-SOURCE-FILE and specialize only on that subclass, but that would defeat its pervasiveness and make it more difficult to have multiple extensions working together. Hence Robert's idea of mixins. My own idea was to have exported operations use a special method combination allowing multiple methods with the same signature.
-- Resistance is futile. You will be jazzimilated.
Jazz site: http://www.didierverna.com Other sites: http://www.didierverna.info