Per, I don't know how your system resolves symbols. Fixing the DEFINE problem is one thing, but how do you resolve other identifiers?
I don't know exactly what you want me to explain here, but I'll give it a shot. First, a couple of basic premises: My implementation almost entirely bypasses Gambit namespaces. There are several reasons for it, I won't take them here. Basically it's more trouble than it's worth. Also, the system is designed in a way that doesn't let the user choose namespaces, it is seen completely as an implementation detail. The ns#id syntax is supported, and is used internally, but production code doesn't need it and shouldn't have it.
Every define expression expands into a fully qualified name before it reaches Gambit. In the current version, the REPL has the namespace ~, so if you just boot it up and write (define a #f) it expands into (##define ~#a #f)
The environment keeps track of all imported identifiers and their names. For instance, you could write
(import (prefix: (only: (std srfi/1) fold) 1/))
(Yes, the syntax gets a little bit unreadable when doing more advanced stuff, but I couldn't come up with any better. Plus, it's close to R6RS libraries, so I figure it's ok.)
After this, 1/fold will expand into 1_#fold (1# is a reserved namespace for coloring, so it's renamed to 1_#)
Is this what you were thinking of when asking the question?
The main question in my mind... what is lacking in this module system to implement other module systems (such as Scheme48's, PLT's, Chicken's, Bigloo's, Guile's). I would like people on this list (yes *you*) to chip in by picking one of these module systems and trying to implement it on top of strawman
Unfortunately I don't have the time to give you as full of a report as I'd like, but off the top of my head:
- Scoping correctness (ability to define "car" locally, for example)
- Identifier renaming
- Syntactic tower-like behavior (being able to import a module for
macro expansion time)
This week I have implemented all those three in black hole. (I'm not 100% sure that the syntactic tower thing is entirely conceptually correct though. I'd love to discuss that here) There is still a bug when having define-syntax forms directly inside let(rec)-syntax forms, but I have decided to leave that for now and give the problem some rest for my head to process it.
/Per