1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-23 13:00:34 +02:00

`load' autocompiles -- in the current module.

* module/ice-9/boot-9.scm (load): Pull `autocompiled-file-name' inside
  `load', and make it autocompile in the current module. Should fix
  Julian's issue noted in
  http://article.gmane.org/gmane.lisp.guile.devel/9483.
This commit is contained in:
Andy Wingo 2009-10-15 15:48:14 +02:00
parent b0217d1704
commit 1ab3976ef7

View file

@ -899,12 +899,13 @@
(set! %load-hook %load-announce) (set! %load-hook %load-announce)
;;; Returns the .go file corresponding to `name'. Does not search load (define (load name . reader)
;;; paths, only the fallback path. If the .go file is missing or out of ;; Returns the .go file corresponding to `name'. Does not search load
;;; date, and autocompilation is enabled, will try autocompilation, just ;; paths, only the fallback path. If the .go file is missing or out of
;;; as primitive-load-path does internally. primitive-load is ;; date, and autocompilation is enabled, will try autocompilation, just
;;; unaffected. Returns #f if autocompilation failed or was disabled. ;; as primitive-load-path does internally. primitive-load is
(define (autocompiled-file-name name) ;; unaffected. Returns #f if autocompilation failed or was disabled.
(define (autocompiled-file-name name)
(catch #t (catch #t
(lambda () (lambda ()
(let* ((cfn ((@ (system base compile) compiled-file-name) name)) (let* ((cfn ((@ (system base compile) compiled-file-name) name))
@ -921,7 +922,8 @@
(%load-should-autocompile (%load-should-autocompile
(%warn-autocompilation-enabled) (%warn-autocompilation-enabled)
(format (current-error-port) ";;; compiling ~a\n" name) (format (current-error-port) ";;; compiling ~a\n" name)
(let ((cfn ((@ (system base compile) compile-file) name))) (let ((cfn ((@ (system base compile) compile-file) name
#:env (current-module))))
(format (current-error-port) ";;; compiled ~a\n" cfn) (format (current-error-port) ";;; compiled ~a\n" cfn)
cfn)) cfn))
(else #f)))))) (else #f))))))
@ -930,8 +932,6 @@
";;; WARNING: compilation of ~a failed:\n;;; key ~a, throw_args ~s\n" ";;; WARNING: compilation of ~a failed:\n;;; key ~a, throw_args ~s\n"
name k args) name k args)
#f))) #f)))
(define (load name . reader)
(with-fluid* current-reader (and (pair? reader) (car reader)) (with-fluid* current-reader (and (pair? reader) (car reader))
(lambda () (lambda ()
(let ((cfn (autocompiled-file-name name))) (let ((cfn (autocompiled-file-name name)))