Hi All, I was hoping to kludge together a procedure to load a file containing a non-Scheme extension language. I am not surprised that it doesn't work, given the complexity of the load/compile code in (ice-9 boot-9 (check load-in-vicinity) and (system base compile) (check compile-file). Any ideas how to make progress?
(define file-ext-map '(("scm" . scheme) ("js" . ecmascript))) (define* (load/x file-name) (let* ((ext (and=> (string-rindex file-name #\.) (lambda (ix) (substring file-name (1+ ix))))) (ext-lang (assoc-ref file-ext-map ext))) (simple-format #t "loading a ~S file\n" ext-lang) (parameterize ((current-language ext-lang)) (load file-name)))) Notice in my test below that I get dumped into ecmascript in the debugger. When I exit, I'm back in Scheme mode. Also, if I try to load with normal load I get the same error message. scheme@(guile-user)> (load/x ",zz.js") loading a ecmascript file ERROR: In procedure %resolve-variable: Unbound variable: var Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. ecmascript@(guile-user) [1]> ,bt 2 (primitive-load-path "nyacc/lang/javascript/,zz.js") In ice-9/eval.scm: 223:20 1 (proc #<directory (guile-user) 2231140>) In unknown file: 0 (%resolve-variable (7 . var) #<directory (guile-user) 2231140>) ecmascript@(guile-user) [1]> scheme@(guile-user)> (load ",zz.js") ERROR: In procedure %resolve-variable: Unbound variable: var Matt P.S. I am not working on ecmascript but my own javascript, with goal to generate tools and procedures for adding more extension languages with nyacc.