This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I am somewhat guessing, but it seems as if you have run into module system problems. `use-modules' has indeed a limited effect, but it is limited to modules not files. The symbols imported by a `use-modules' are only visible in the module current when the use-modules was issued. Guile starts up in a special root module, which probably has a name, but also is the value of the variable `the-root-module'. However, the module in which the read-eval-print-loop runs is called (guile-user). Somewhere bewteen starting up and starting the user interaction, the system changes module from the root to guile-user. In the old days, this was done at the end of booting (loading ice-9/boot-9.scm) but currently it happens first when starting the REPL. What this means is that -c and -l (and, presumably, loading of .guile) happens in the root module while you are interacting in the guile-user module. Thus slib is imported but not to the module you are using when running interactively. Now, the root module is special in the sense that all symbols defined in that are accessible in all other modules, but this does not (it appears) apply to imported symbols! Thus having a define and an use-modules in .guile would mean that the defined symbol was acceesible everywhere but the imported symbol wasn't! So what can you do about it? The simple solution is to put a (define-module (guile-user)) at the top of your .guile file thus making sure you are importing any modules into the module in which you interact. If you are doing some definitions that should visible in all modules make sure these goes before the define-module. I really wish that wasn't necessary. The schism between the environment you are seeing when running interactively and that of scripts and command line parsing can drive me and my colleagues wild. One of them has given completely up on modules thinking they must be part of some evil plot against his sanity, though I personally believe that to be just a wee bit exaggerated :-) PS You can use `(current-module)' to see what module is current and use `(set-current-module the-root-module)' to force the root module be current (`set-current-module' operates on the values produced by `current-module'). ---------------------------+-------------------------------------------------- Christian Lynbech | Telebit Communications A/S Fax: +45 8628 8186 | Fabrik 11, DK-8260 Viby J Phone: +45 8628 8177 + 28 | email: chl@tbit.dk --- URL: http://www.telebit.dk ---------------------------+-------------------------------------------------- Hit the philistines three times over the head with the Elisp reference manual. - petonic@hal.com (Michael A. Petonic)