[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
module system
From: |
Dr. Peter Ivanyi |
Subject: |
module system |
Date: |
Thu, 15 May 2003 13:42:38 +0100 |
Hi,
I would like to be able to define a module in the "same" way for guile,
bigloo and plt-scheme, but mostly the first two. I know guile a little
better so I thought I will try to modify the behaviour of guile. In bigloo
a module is defined with
(module ...)
format. So I thought I will write a macro which transforms the bigloo
module definition to guile format. And here I have a little problem.
I have two files:
------------------------------ l.scm ----------------------------
(define-macro (module args)
`(define-module ',@args)
)
(use-modules (m m))
(display var)(newline)
(set! var 5)
(display var)(newline)
------------------------------------------------------------------
------------------------------- m/m.scm --------------------------
(module (m m))
(export var)
(define var #f)
------------------------------------------------------------------
Running this gives the following:
address@hidden $ guile -s l.scm
ERROR: no code for module (m m)
If in "l.scm" I use
(defmacro module args
`(define-module ',@args)
)
it gives:
address@hidden $ guile -s l.scm
ERROR: In procedure variable-set-name-hint!:
ERROR: Wrong type argument in position 2 (expecting SYMBOLP): (m m)
However if I copy the define-module from "boot-9.scm" into "l.scm" and
rename it to "module" it works. I would like to avoid copying macro from
"boot-9.scm". Can somebody help me to sort out what I am doing wrong?
With the first variation why could it not find the code? The module macro
should expand into the define-module macro which expands further and then
I should have the same effect. But obviously something else is happening.
Thanks for any help.
Peter Ivanyi
- module system,
Dr. Peter Ivanyi <=