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

From: Sam Tobin-Hochstadt <samth>
Date: Fri Nov 17 08:42:36 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
Received on Fri Nov 17 2006 - 08:42:26 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC