From 707b812ef43f15a72d18b917e6f8323708570cbf Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 9 Aug 2008 14:23:20 +0200 Subject: [PATCH] warn and load source file if newer than compile file * ice-9/boot-9.scm (try-module-autoload): Warn if the compiled file is older than the source file, and in that case load the source file. --- ice-9/boot-9.scm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm index 8e2aeefe4..5c884ceca 100644 --- a/ice-9/boot-9.scm +++ b/ice-9/boot-9.scm @@ -2166,14 +2166,20 @@ module '(ice-9 q) '(make-q q-length))}." (lambda () (autoload-in-progress! dir-hint name)) (lambda () (let ((file (in-vicinity dir-hint name))) - (cond ((and load-compiled - (%search-load-path (string-append file ".go"))) - => (lambda (full) - (load-file load-compiled full))) - ((%search-load-path file) - => (lambda (full) - (with-fluids ((current-reader #f)) - (load-file primitive-load full))))))) + (let ((compiled (and load-compiled + (%search-load-path + (string-append file ".go")))) + (source (%search-load-path file))) + (cond ((and source + (or (not compiled) + (< (stat:mtime (stat compiled)) + (stat:mtime (stat source))))) + (if compiled + (warn "source file" source "newer than" compiled)) + (with-fluids ((current-reader #f)) + (load-file primitive-load source))) + (compiled + (load-file load-compiled compiled)))))) (lambda () (set-autoloaded! dir-hint name didit))) didit))))