guile-devel
[Top][All Lists]
Advanced

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

Re: module trickery


From: Thomas Bushnell, BSG
Subject: Re: module trickery
Date: 30 Aug 2002 16:02:34 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Marius Vollmer <address@hidden> writes:

> address@hidden (Thomas Bushnell, BSG) writes:
> 
> > (module-use! special-module (resolve-module '(python syntax)))
> > 
> > The (python syntax) module creates syntax with define-syntax, and does
> > nothing out of the ordinary.
> > 
> > When I evaluate expressions in special-module which use the syntax
> > defined in (python syntax), things go into an infinite loop.  The
> > macro I'm testing is blindingly simple and works fine in a normal
> > environment.
> 
> Please try what happens when you also do
> 
>   (use-modules (ice-9 syncase))
>   (module-use! special-module (resolve-module '(ice-9 syncase)))
>   (set-module-transformer! special-module syncase)
> 
> The 'module transformer' needs to be set up so that syntax-case
> expansion can work.

No discernable effect.  Here is exactly what I have so far...

The macros are defined inside (define-module (python syntax)).

Then I want to incorporate those macros into my special module; which
is set up as follows:

(define python-toplevel (make-module))
(beautify-user-module! python-toplevel)
(module-use! python-toplevel (resolve-module '(python syntax)))
(module-use! python-toplevel (resolve-module '(ice-9 syncase)))
(set-module-transformer! python-toplevel syncase)

;;; Insert the definitions of the (python __builtin__) module
;;; into python-toplevel.  Note that this is not an import: we
;;; do *not* share bindings with the module.  That's because we
;;; shouldn't allow sets here to blow them away.
(module-for-each
 (lambda (name variable)
   (module-define! python-toplevel name (variable-ref variable)))
 (resolve-module '(python __builtin__)))


Then I want to evaluate expressions inside this module with the
following:

(eval-in-module SEXP python-toplevel)


I'm quite flexible here... anything that lets me set up the relevant
module and do eval-in-module will be fine by me.  Switching from Guile
1.4 to the latest 1.5 test release is not unacceptible, if it will
really work.

Thomas




reply via email to

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