Hello,

Even after R6RS, 'load' is all one can really count on. :-)

Below is a "hacked" version of load that I'm using for Chicken. If an '.so' file doesn't exist for the file your loading, the file is compiled and one is generated. If it does exist but it's out of date, your file is recompiled, then the '.so' file is loaded. Otherwise, the '.so' is loaded straight away.

Ed

(use files)
(use posix)

(define chicken-scheme-load load)

(define (file-newer? a b)
  (> (file-change-time a)
     (file-change-time b)))

(define (load scheme-file)

  (let ((so-file (pathname-replace-extension scheme-file "so")))

    (cond

     ((and (file-exists? so-file)
           (file-newer? so-file scheme-file))
      (chicken-scheme-load so-file))

     (else
      (display "Compiling file: ") (display scheme-file) (newline)

      (system (string-append "csc -dynamic -run-time-macros " scheme-file))

        (load scheme-file)))))


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to