[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

%load-hook only used within primitive-load?

From: nalaginrut
Subject: %load-hook only used within primitive-load?
Date: Thu, 14 Apr 2011 18:05:59 +0800

hi all.
I found the manual said "%load-hook is used by all of the above loading
functions (load,load-path, primitive-load and primitive-load-path)".
But it seems only "primitive-load" according to it.
If I want to add a load-path before loading a file(assume foo.scm is
under "/tmp/foo"):
(define add-new-path 
  (lambda (p) 
     (call/cc (lambda (ret) 
                  (lambda (x) 
                    (if (string=? x p) (ret #f))) %load-path) #t))
     (set! %load-path (cons p %load-path)))))
     ;; add new path without redundancy

(set! %load-hook (lambda (filename) (set! %load-path (add-new-path

(load-from-path "foo.scm")
Then it's failed. This path-add operation didn't occur. %load-path is
untouched. But this will:
(primitive-load "foo.scm") ;; will fail
(load-from-path "foo.scm") ;; success
And I found %load-hook will only be used within primitive-load, even a
simple filename-print instance copied from manual. I think it's not
according to the manual.

My questions are:
[1] Is this accepted?
[2] I'm failed to find "load" procedure(well,I can find sym_load but no
further), anybody give me a hint?

GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut

--hacker key--
---end key---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]