[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: module system
From: |
rm |
Subject: |
Re: module system |
Date: |
Thu, 15 May 2003 16:59:11 +0200 |
User-agent: |
Mutt/1.5.3i |
On Thu, May 15, 2003 at 02:20:35PM +0100, Dr. Peter Ivanyi wrote:
> address@hidden wrote:
>
> > Hmm, shouldn't this be
> >
> > (defmacro module args
> > `(define-module ,args))
> >
>
> I also tried that. The result is:
>
> address@hidden $ guile -s l.scm
> ERROR: In procedure variable-set-name-hint!:
> ERROR: Wrong type argument in position 2 (expecting SYMBOLP): (m m)
>
> The reason I have tried so many variations is that there is slight
> difference between defmacro and define-macro but I could not figure
> out what. Sometimes one of them works, sometimes the other.
Well, my approach would be like this:
;; --------------------- File: mod-comp.scm
(use-modules (ice-9 syncase))
(define-syntax module
(syntax-rules ()
((module (a))
(define-module (a)))
((module (a ...))
(define-module (a ...)))))
;))
(define (glob fu)
(format #t "GLOB: ~A!\n" fu))
(export glob)
; ---------------------- File: a.scm
;; A sample module
(module (a))
(define (glob fu)
(format #t "GLOB: ~A!\n" fu))
(export glob)
And then:
address@hidden:/tmp$ guile -l mod-comp.scm
guile> (use-modules (a))
guile> (glob "Fubby")
GLOB: Fubby!
guile> ^D
Seems to work here ...
hth Ralf Mattes
> Peter Ivanyi
>
>
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-user