From: Jose Antonio Ortega Ruiz Date: Sat, 27 Oct 2012 23:38:17 +0000 (+0200) Subject: Racket: fix for module evaluation/entering X-Git-Tag: 0.3~9 X-Git-Url: https://repo.or.cz/w/geiser.git/commitdiff_plain/f5144a27494a1e83d658d400289ba104b050ffd3 Racket: fix for module evaluation/entering Our module loader is receiving load requests for module names represented as lists that are not exactly a submodule, in the sense that the path does not represent an actual file. This phenomenon happens for instance when specifying a reader in a #lang tag. E.g. #lang at-exp racket will cause the loader to be called with module name '(main reader) and path /at-exp/main.rkt, where main.rkt does not exist. Afterwards, we see a call to load at-exp/lang/reader/rkt, with name reader, which is the real code. So, for now, i'm skipping all load requests with a list name, forwarding them to racket's default loader. --- diff --git a/scheme/racket/geiser/enter.rkt b/scheme/racket/geiser/enter.rkt index b2e233f..6da8c7a 100644 --- a/scheme/racket/geiser/enter.rkt +++ b/scheme/racket/geiser/enter.rkt @@ -39,10 +39,6 @@ (define (module-loader orig) (enter-load/use-compiled orig #f)) -(define (notify re? path) - (when re? - (fprintf (current-error-port) " [re-loading ~a]\n" path))) - (define inhibit-eval (make-parameter #f)) (define (get-namespace mod) @@ -85,10 +81,14 @@ (let ([cmps (explode-path path)]) (find (car cmps) (cdr cmps)))) +(define (notify re? path) + (when re? (fprintf (current-error-port) " [re-loading ~a]\n" path))) + (define ((enter-load/use-compiled orig re?) path name) (when (inhibit-eval) (raise (make-exn:fail "namespace not found" (current-continuation-marks)))) - (if (and name (or (not (list? name)) (car name))) ;; submodule names are lists + ;; (printf "Loading ~s: ~s~%" name path) + (if (and name (not (list? name))) ;; Module load: (let* ([code (get-module-code path "compiled" @@ -106,7 +106,6 @@ ;; Not a module: (begin (notify re? path) (orig path name)))) - (define (get-timestamp path) (let ([ts (file-or-directory-modify-seconds path #f (lambda () #f))]) (if ts @@ -121,6 +120,8 @@ (values -inf.0 path))) (values -inf.0 path))))) +(define orig (current-load/use-compiled)) + (define (check-latest mod) (define mpi (module-path-index-join mod #f)) (define done (make-hash))