chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Avoiding transitively using macros?


From: felix winkelmann
Subject: Re: [Chicken-users] Avoiding transitively using macros?
Date: Mon, 23 May 2005 23:59:10 -0700

On 5/20/05, Reed Sheridan <address@hidden> wrote:
> Hi,
> 
> I have 2 packages, macro-package-1 and macro-package-2, which has
> (require-extension macro-package-1).  The problem is that another
> file, which has (require-extension macro-package-2), can use macros
> from macro-package-1.  I would prefer that it didn't.  Is there any
> way to avoid this?
> 

For more complex namespace issues I would suggest using the
psyntax/syntax-case module system. Here a small example: we
have two extensions, both exporting only syntax:

; m1.setup
(install-extension 'm1 "m1.scm" '((syntax)))

; m2.setup
(install-extension 'm2 "m2.scm" '((syntax)))

; m1.scm
(module m1 (foo bar)

  (define-syntax foo (identifier-syntax 123))

  (define-syntax bar
    (syntax-rules ()
      ((_ x) (list x)) ) )

)

; m2.scm
(module m2 (go)

  (import m1)

  (define-syntax go
    (identifier-syntax foo) )  ; foo is not exported!

)

; m3.scm
(use m1 m2)

(import m2)

(print go)  ; ok
(print foo) ; error


It is important that extensions that export syntax are also
installed ias source (so the ".scm" file has to be copied into
the repository as well), because the `import' form might
need to scan the source for syntax-definitions.


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]