chicken-janitors
[Top][All Lists]
Advanced

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

Re: [Chicken-janitors] #219: reexport with renaming fails when import li


From: Chicken Trac
Subject: Re: [Chicken-janitors] #219: reexport with renaming fails when import libraries are used
Date: Sat, 29 Sep 2012 22:07:34 -0000

#219: reexport with renaming fails when import libraries are used
-----------------------+----------------------------------------------------
  Reporter:  felix     |       Owner:        
      Type:  defect    |      Status:  new   
  Priority:  major     |   Milestone:  4.9.0 
 Component:  expander  |     Version:        
Resolution:            |    Keywords:  syntax
-----------------------+----------------------------------------------------

Comment(by sjamaan):

 After some investigation, it became clear that the set-car! calls in the
 foreaches of {{##sys#register-compiled-module}} are clobbering the
 carefully saved syntax environments of each macro.

 In the example, when {{foo1}} is imported and the {{find-reexport}} helper
 procedure in {{##sys#register-compiled-module}} finds the matching
 original binding ({{s1}} for {{f1:s1}}) that's being re-exported, it has a
 syntax environment containing both {{s1}} and {{s2}}.
 You can see this in action if you apply this debugging patch:

 {{{
 diff --git a/modules.scm b/modules.scm
 index b1571c2..4c78320 100644
 --- a/modules.scm
 +++ b/modules.scm
 @@ -33,7 +33,7 @@

  (include "common-declarations.scm")

 -(define-syntax d (syntax-rules () ((_ . _) (void))))
 +#;(define-syntax d (syntax-rules () ((_ . _) (void))))

  (define-alias dd d)
  (define-alias dm d)
 @@ -347,7 +347,7 @@
    (define (find-reexport name)
      (let ((a (assq name (##sys#macro-environment))))
        (if (and a (pair? (cdr a)))
 -         a
 +         (begin (dm `(FOUND-REEXP: ,(car a) ---> ,(map-se (cadr a)))) a)
           (##sys#error
            'import "cannot find implementation of re-exported syntax"
            name))))
 }}}

 However, after the module is register, if you inspect {{##sys#module-
 environment}}, the syntax environment attached to {{f1:s1}} contains
 {{f1:s1}} and {{f1:s2}}.  It's been replaced by the foreach loops.

 I'm unsure how to fix this.  What's the reason these environments are
 reset the way they are?

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/219#comment:2>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

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