[r6rs-discuss] [Formal] Replacing the import's "for" syntax with implicit phasing

Sam Tobin-Hochstadt samth at ccs.neu.edu
Fri Nov 17 08:42:26 EST 2006


On Fri, 2006-11-17 at 03:47 -0500, Abdulaziz Ghuloum wrote:

> Suppose the library F is defined as follows:
> 
> (library F
>    (export f)
>    (import r6rs)
>    (define f 12))
> 
> Also, suppose G imports F because it needs it:
> 
> (library G
>    (export g)
>    (import r6rs (for F expand))
>    (let-syntax ([m (lambda (_) f)])
>      (define g (m)))
>    --other-stuff--)
> 
> Expanding G causes
>    F to be visited (not needed: doesn't use any of F's macros)

This is incorrect.  Visiting F is necessary to determine what bindings F
provides.  For example, if F is:

(library F
  (export f)
  (import r6rs)
  (define-syntax def12
    (syntax-rules ()
      [(_ v) (define v 12)]))
  (def12 f))

Then it is of course necessary to evaluate the right hand side of def12
(performed in the course of visiting F) in order to evaluate the right
hand side of f (that is, to invoke F).  

>    F to be invoked (needed to evaluate F's f)

sam th




More information about the r6rs-discuss mailing list