guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Module unloading


From: Neil Jerram
Subject: Re: Module unloading
Date: Tue, 24 May 2005 19:15:24 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050420 Debian/1.7.7-2

Zeeshan Ali wrote:
Hello,


It seems to survive 5 minutes of testing by me, but there could well be
problems lurking, so please test carefully in your context.


   I'll try to test it here as well but i'll have to convert it to an
equivalent C code first.

Out of interest, why is that? (It's easy enough to call Scheme-defined code from C, isn't it?)


BTW guys,

      I have been told that the fate of 'undefine' is in doubt. Is
that really true? Here is how i load modules and tell me if there is a
better way of doing the same:

1. load the module using scm_c_use_module ()
2. The module is responsible to define and export a few symbols (e.g
xchat-plugin-version)
3. I get the value of these symbols and
4 undefine these varriables

That sounds more complex and magic than it needs to be, to me - where by "complex" I mean your infrastructure code using undefine, and by "magic" I mean that it requires plugin authors to follow a non-code-enforced convention about the names of the variables. Why not use a registration API instead? In other words, instead of this:

(define (do-plugin-thing-1 ...) ...)
(define (do-plugin-thing-2 ...) ...)
...

do this:

(let ()
  (define (do-plugin-thing-1 ...) ...)
  (define (do-plugin-thing-2 ...) ...)
  ...
  (register-plugin do-plugin-thing-1
                   do-plugin-thing-2
                   ...))

This way there is no magic, and the visibility of the plugin bindings is under the control of the plugin author. Also, this way you could stay pure-R5RS if you like, as you don't really need any features of the module system.

Regards,
        Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]