This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
RE: Small troubles in startup
- To: jl_daschbach at pnl dot gov, 'Greg Harvey' <Greg dot Harvey at thezone dot net>
- Subject: RE: Small troubles in startup
- From: "Daschbach, John L" <John dot Daschbach at pnl dot gov>
- Date: Tue, 30 Nov 1999 15:43:28 -0800
- Cc: guile at sourceware dot cygnus dot com
Thanks.
This seems like it could be a problem in many cases since many core scheme
functions are now implemented in the module system, e.g. open-pipe. This means
that a user doesn't see a real scheme until modules are loaded, and this has to
be done by hand. Calls to use-modules in the .gule file are not visible.
I have not yet found a syntax in the documentation that describes how to access
variables defined in these calls to use-modules. The TeXinfo doc's seem way out
of date on this issue. The obvious, to me a least, syntax using CL or Perl
concepts 'root-module:open-pipe' or 'root-module::open-pipe' don't work.
A number of work arounds exist, but this seems like a step backwards from the CL
or Perl namespace usage. The obvious work arounds to me are: 1.) in .guile
define a function that calls all the modules you want to use, e.g. (define
(jinit) (use-modules (ice-9 slib)) (use-modules (ice-9 popen))) and then call
this by hand in the repl. 2.) For every function/variable in a module you want
to use define a new variable in .guile which is bound to the module version.
This is a usable but clumsy way to do importing of variables.
Is there, or could there be, a hook in the standard repl to load an init file
into the guile-user module?
Another question. The slib printf function seems broken for numbers in guile
but works fine in scm. Has anybody else had this trouble?
-John
----------
From: Greg Harvey
Sent: Tuesday, November 30, 1999 3:56 PM
To: jl_daschbach@pnl.gov
Cc: guile@sourceware.cygnus.com
Subject: Re: Small troubles in startup
John Daschbach <d3h486@wd19518.emsl.pnl.gov> writes:
> I have been trying guile for some simple projects in place of scm.
> Mostly it is going well, but I have some questions about startup.
> I usually do something like the following
>
> gh_new_procedure2_0("thob", thob);
> gh_new_procedure("scmode", scmode,3,0,0);
> gh_load("tidutil.scm");
> gh_repl(argc,argv);
>
> and then run in the repl, using C functions and scheme utility
> functions defined in tidutil.scm. This is pretty tame guile use, and
> I have found it reasonably easy once I converted to using autoconf and
> libtool.
>
> My problem is that while most things loaded from tidutil.scm are
> visible in the repl, calls to use-modules seem to not be visible. I
> do the following in tidutil.scm
>
> (use-modules (ice-9 slib))
> (use-modules (ice-9 popen))
>
> but nothing defined in these modules is visible in the repl. I have
> to make these calls by hand in the repl. All of my definitions in
> tidutil.scm are visible.
Funny, came across a very similar problem today: before you enter the
repl, you're in root-module; when the repl is called you're moved to
guile-user, which won't be able to see anything that is used by the
root module. Dunno if there's a particularly nice way of avoiding this
besides doing a (use-modules ...) from the repl.
> Is there something simple I'm missing here?
>
> -John
>
>
--
Greg