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

A portable implementation



I have completed a portable implementation of SRFI-83.  This
implementation is fully integrated with my portable SRFI-72 macro
expander.  

It can be found at:

  http://www.het.brown.edu/people/andre/macros/index.htm
  
and will be updated, time permitting, as SRFI-83 evolves.

The semantics is as in SRFI-83, but has been extended to
allow import into higher phases (as is need when let-syntax
is nested).

Example:

  (library "m" "scheme://r6rs"
    (export z)
    (define z 1))
  
  (import (for "m" run expand 2))  ; also (import (for "m" 0 1 2 ...))
  
  (let-syntax ((foo (lambda (form)
                      (let-syntax ((bar (lambda (form)
                                          (quasisyntax
                                           (quasisyntax (list z ,z ,,z))))))
                        (bar)))))
    (foo))   
               ;==> (1 1 1)


The import syntax is:

  (for <import-set> <import-phase>*)

where

  <import-phase> ::= run | expand | all | 0 | 1 | 2 | ...

Here 0 == run, 1 == expand, and |all| wil cause import into
all phases, which is implicitly done with the <language>.
See the link for many commented examples of use.

The semantics is as follows:

To invoke a library at phase N:

   * Invoke at phase N any library that is imported by this library
     for run time, and that is not yet invoked at phase N. 
   * Evaluate all variable definitions and top-level expressions within
     the library. (Macro definitions are not evaluated.)

To visit a library at phase N:

   * For each k >= 1, invoke at phase N+k any library that is imported
     by this library for .... (phase k), and that is not yet invoked at
     phase N+k.
   * For each k >= 0, visit at phase N+k any library that is imported by
     this library for .... (phase k), and that is not yet visited at phase
     N+k.
   * Evaluate all syntax definitions within the library.
     (Top-level expressions are not evaluated, and the right-hand sides
     of variable definitions are not evaluated.)

Technical remarks:
------------------

* We do not enforce the no-shadowing and no-multiple-import
  constraints.
* We allow different bindings for the same identifier to be
  imported into different phases.
 
See the link for further description and commented examples.

Regards
Andre