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

psyntax.ss and module system


Keisuke Nishida <kxn30@po.cwru.edu> writes:

> I just started looking at psyntax.ss...

Please keep me updated on your progress.  If you get stuck, I might
want to do this soon anyway since I need this in my code.

What you should do is this:

Extend `sc-expand' with the extra argument `env'.  This argument
should be of the same kind as that passed to current native Guile
macors, i.e. the local lexical environment.

From this environment you can extract the last pair, where the CAR
should be a lookup closure.

If there is a lookup closure, `r' should have that last pair as
initial value.  If not, `r' should be '() as now.

Replace `assq' with `sloppy-assq' in lookup and pass the last pair to
the global lookup function if there is no local syntactic binding.

I suggest that we keep the current mechanism of storing the syntactic
binding as an object property until we have removed the old Guile
macro system.  Currently, it is convenient to be able to store the
`sc-macro' expander (which is an old Guile macro) in the non-syntactic
top-level bindings for syntactic keywords.

So, the only change in the top level lookup hook is that it uses the
eval closure to get the variable object instead of using
`(current-module)'.


As you know, we can still not use syntax-case macros together with
GOOPS since GOOPS uses Guile's native macros and these don't interact
well with syntax-case.

But this night I got a new idea on how to implement a kludge which
makes them cooperate partially until we can remove the old Guile
macros.

The idea is to halt syntax-case macro processing when a native Guile
macro is encountered.  What we do is that we pack all current state in
the sc macro expander (w and r), together with the native Guile macro
call, into another native Guile macro call which we plant at this site
in the code.

When Guile evaluation next comes to this place, this macro (an mmacro)
first expands the stored native Guile macro form and then calls the sc
expander with the stored state (w and r) so that it can continue
expansion on the macro output.

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