This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I'd become a bit bothered by the way that guile's use-modules will not import any of the modules if even just one of the imports fails. This is especially problematic in user's .scwmrcs because a single missing module will result in all modules not being loaded, and most of the rest of the file being nonsense. Of cource one could write: (use-modules (app scwm base)) (use-modules (app scwm winops)) (use-modules (app scwm winlist)) (use-modules (ice-9 string-fun)) .... etc. instead of invoking the use-modules macro only once, but it's already reduandant enough. To address this problem, I just added the included code below to Scwm's minimal.scm to provide a `use-scwm-modules' macro, usable like so: (use-scwm-modules base winops winlist (ice-9 string-fun)) (note that just a symbol defaults to assumming (app scwm foo)). If, for example, winlist is misspelled or missing, the other modules will still load just fine, and Scwm has a far better chance of being usable. If this isn't possible in some other way in guile, I think making use-modules more tolerant of errors should be considered. Greg ;; Guile/Scheme code follows (define-public (process-use-scwm-module module) (if (symbol? module) (set! module (append '(app scwm) (list module)))) (catch #t (lambda () (process-use-modules (list module)) #t) (lambda (key . args) (display "Error loading module: ") (display module) (newline) #f))) (define-public (process-use-scwm-modules module-list) (map process-use-scwm-module module-list)) (defmacro use-scwm-modules modules `(process-use-scwm-modules ',modules))