unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: nalaginrut <nalaginrut@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: %load-hook only used within primitive-load?
Date: Thu, 14 Apr 2011 18:05:59 +0800	[thread overview]
Message-ID: <1302775559.2639.122.camel@Renee-desktop> (raw)

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




             reply	other threads:[~2011-04-14 10:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 10:05 nalaginrut [this message]
2011-06-30 10:56 ` %load-hook only used within primitive-load? Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302775559.2639.122.camel@Renee-desktop \
    --to=nalaginrut@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).