per-gron / blackhole

Module system for the Gambit-C Scheme system
MIT License
41 stars 13 forks source link

Implicit phasing on imports #22

Open per-gron opened 14 years ago

per-gron commented 14 years ago

As in http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.151.1568

In practise this would mean to drop syntax-begin and/or import-for-syntax, and just have import, letting the module system infer in which phases you want to import each module. I think this would make it more intuitive to write macros, which is a good thing.

per-gron commented 12 years ago

Hmm.. I've forgotten most of what's required to implement this.

Trying to remember:

per-gron commented 12 years ago

Doing this might remove the need of storing phase numbers in some parts of the environment ns data structure, (but not all?) in particular the table thing.

per-gron commented 12 years ago

One thing that needs to be done is to modify resolve-imports so that it only returns one value (not a list of module references). To do this, module-import needs to be modified so that it doesn't load the modules immediately, and the default *external-reference-access-hook* needs to be modified to load modules when they are encountered. Furthermore, something needs to be done about macros, I think, because *external-reference-access-hook* doesn't get invoked for macros.

BUT: I'm not sure this should be done at all. What I've done so far might be sufficient, because it might actually be desirable for modules to be loaded eagerly in the REPL. But how does that work together with phases? I don't know.

per-gron commented 12 years ago

For the record: The module metadata fields compiletime-dependencies and runtime-dependencies are now calculated from the expanded source and not from the import expressions.