chicken-janitors
[Top][All Lists]
Advanced

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

[Chicken-janitors] Re: #398: Nested let-syntax failure to strip renamed


From: Chicken Trac
Subject: [Chicken-janitors] Re: #398: Nested let-syntax failure to strip renamed identifiers
Date: Tue, 28 Sep 2010 12:48:52 -0000

#398: Nested let-syntax failure to strip renamed identifiers
-----------------------+----------------------------------------------------
  Reporter:  sjamaan   |       Owner:                               
      Type:  defect    |      Status:  new                          
  Priority:  major     |   Milestone:  4.7.0                        
 Component:  expander  |     Version:  4.6.x                        
Resolution:            |    Keywords:  expander, renamed identifiers
-----------------------+----------------------------------------------------
Changes (by felix):

  * priority:  minor => major


Comment:

 This patch seems to help (at least runs the test-suite). It is incomplete
 (must be done for all binding forms) and should be refactored (say, a
 system-function in expand.scm that extends an SE with a given set of
 aliased variables), but may indicate a solution: the SE of `foo` contains
 `(a . a0)` mapping `a` to a gensym. At the point where `quote` (really:
 `##core#quote`) strips syntax off the argument form, the mapping of `a` to
 `a0` is not available anymore (it exists only inside the static SE of
 `foo`). Here I register the original name on the plist of the generated
 gensym which will be seen by `strip-syntax`. Looks somewhat hackish, but
 seems to work.

 {{{
 diff --git a/compiler.scm b/compiler.scm
 index 5ae4664..e198367 100644
 --- a/compiler.scm
 +++ b/compiler.scm
 @@ -612,6 +612,9 @@
                                 (aliases (map gensym vars))
                                 (se2 (append (map cons vars aliases) se))
 )
                            (set-real-names! aliases vars)
 +                          (for-each
 +                           (cut ##sys#put! <> '##core#real-name <>)
 +                           aliases vars)
                            `(let
                              ,(map (lambda (alias b)
                                      (list alias (walk (cadr b) e se (car
 b) #t)) )
 diff --git a/eval.scm b/eval.scm
 index b531547..12f927b 100644
 --- a/eval.scm
 +++ b/eval.scm
 @@ -393,6 +393,9 @@
                                  (aliases (map gensym vars))
                                  [e2 (cons aliases e)]
                                  (se2 (append (map cons vars aliases) se))
 +                                (_ (for-each
 +                                    (cut ##sys#put! <> '##core#real-name
 <>)
 +                                    aliases vars))
                                  [body (##sys#compile-to-closure
                                         (##sys#canonicalize-body (cddr x)
 se2 #f)
                                         e2
 }}}

 Please have a look. If this works, I can try to integrate this in a more
 cleaner way.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/398#comment:9>
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]