unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* %load-hook only used within primitive-load?
@ 2011-04-14 10:05 nalaginrut
  2011-06-30 10:56 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: nalaginrut @ 2011-04-14 10:05 UTC (permalink / raw)
  To: guile-devel

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) 
    (if 
     (call/cc (lambda (ret) 
		(for-each 
                  (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
"/tmp/foo"))))

(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--
v4sw7CUSMhw6ln6pr8OSFck4ma9u8MLSOFw3WDXGm7g/l8Li6e7t4TNGSb8AGORTDLMen6g6RASZOGCHPa28s1MIr4p-x hackerkey.com
---end key---




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: %load-hook only used within primitive-load?
  2011-04-14 10:05 %load-hook only used within primitive-load? nalaginrut
@ 2011-06-30 10:56 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2011-06-30 10:56 UTC (permalink / raw)
  To: NalaGinrut; +Cc: guile-devel

Hi nalaginrut,

On Thu 14 Apr 2011 12:05, nalaginrut <nalaginrut@gmail.com> writes:

> 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.

Fixed, thanks for the report.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-30 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-14 10:05 %load-hook only used within primitive-load? nalaginrut
2011-06-30 10:56 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).