This is the mail archive of the guile@sourceware.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]

Re: Problems with tguile's unexec


>>>>> "Greg" == Greg Badros <gjb@cs.washington.edu> writes:

    Greg> Bernard URBAN <Bernard.Urban@meteo.fr> writes:
    >> >>>>> "Greg" == Greg Badros <gjb@cs.washington.edu> writes:
    >> 
    Greg> When I do: tguile --dump guile-all test-all.scm # (see below
    Greg> for test-all.scm)
    >>
    Greg> and then run ./guile-all, I get a prompt that looks like:
    >>
    guile> <s
    Greg> ^ actually the <= single glyph character
    >>
    Greg> and before every printed response I get
    >>
    Greg> <f ^ same <= single glyph character
    >>
    Greg> For example, below, I entered "4" into the prompt:
    >>
    guile> <s 4
    Greg> <f4
    >>  This is caused by using module (ice-9 emacs).

    Greg> Doh!  I should've known.  Thanks!

    Greg> What are people's thoughts on making just the using of a
    Greg> module have behaviour beyond just exposing new symbols?  (As
    Greg> is the case with the (ice-9 emacs) module that confused me).
    Greg> It seems like if actions are permitted, modules should be
    Greg> allowed to be "use-d" with arguments.

In the current system, you can perform ANY action by loading a module.
This is not different from a standard C/C++ library, where it is possible
on most OS to start some initialisation/finalisation function simply
by loading/unloading the library.

For every powerful tool, you must take care not to shoot yourself in
the foot.

    Greg> This has come up in Scwm where I had some modules that had
    Greg> top-level expressions that added key or mouse bindings.
    Greg> I've since tried to not do any of this, sometimes wrapping
    Greg> the code in a procedure and then asking the user to
    Greg> (enable-foo-bindings) or whatever.  Seems like there are
    Greg> some interesting issues here..

    Greg> Also, I'm confused about why I have to run
    Greg> `load-all-modules' again after starting ./guile-all before
    Greg> the procedures are visible.  Can anyone explain this to me?
    >>  I did no encounter this behaviour (even with (ice-9 emacs)
    >> loaded).  Could you be more specific ? I made the test on
    >> Solaris.

    Greg> On x86 GNU/Linux Redhat-6.0 (glibc) using guile-1.3.5 out of
    Greg> CVS as of yesterday, I do:

    Greg> /usr/bin/tguile --dump guile-all test-all.scm

    Greg> ./guile-all
    guile> open-pipe
    Greg> ERROR: In expression open-pipe: ERROR: Unbound variable:
    Greg> open-pipe ABORT: (misc-error)

    Greg> Type "(backtrace)" to get more information.
    guile> (load-all-modules) open-pipe
    Greg> #<procedure open-pipe (command mode)>

    Greg> Where test-all.scm is as posted before (also reproducible
    Greg> with test-popen.scm:

    Greg> ;; begin test-popen.scm (define-public (load-all-modules)
    Greg> (use-modules (ice-9 popen)))

    Greg> (load-all-modules) ;; end

    Greg> )

    Greg> Could this be due to changes in the module system in recent
    Greg> Guile?  Or are you using the same version and the behaviour
    Greg> is just different on Solaris?  I'm glad to hear that the
    Greg> expected behaviour is for the symbols to be immediately
    Greg> visible in the dumped executable, as otherwise it would seem
    Greg> wrong.

Ok, you are right. I use guile-1.3.4. When you start a dumped
executable, a new repl must begin, and my interpretation is that the
default module is then used, not the one enriched with "use-modules".

But the code has been loaded in the dumped image, so there is no
overhead performing (load-all-modules) to switch to the enriched
interface.

But it is obviously a bug, and I will look at that.

    Greg> Incidentally, is there a good way to write a module that
    Greg> exports symbols from a bunch of modules that it imports?
    Greg> E.g., a single module guile-all.scm that does the
    Greg> use-modules, and then another module can just use that one
    Greg> module and get at all the symbols?
    >>  Here is an example taken from guile-stklos-1.3.3 (file
    >> stklos-3.0b2/stklos-sup):

    Greg> <snip>

    >> It says that the exported symbols from (clos-1.7 clos) and
    >> (tk4.1 win) are added to the exported symbols from
    >> (stklos-3.0b2 stklos-sup).

    Greg> It'd be nice to wrap this functionality in a nice
    Greg> "exporter.scm" module for guile-proper.  No reason for
    Greg> others to be cutting and pasting code for something that is
    Greg> of general, reasonably mainstream use (especially to provide
    Greg> an abstraction barrier given the complexity and flux of the
    Greg> module system).

In boot-9.scm, there is also module-use! which may actually do the
same thing (I discovered this only recently, and did not tried it).

    [...]

-- 

B. Urban

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]