chicken-janitors
[Top][All Lists]
Advanced

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

[Chicken-janitors] Re: #504: define-syntax in begin-for-syntax body inef


From: Chicken Trac
Subject: [Chicken-janitors] Re: #504: define-syntax in begin-for-syntax body ineffective
Date: Thu, 24 Feb 2011 20:37:42 -0000

#504: define-syntax in begin-for-syntax body ineffective
-----------------------+----------------------------------------------------
  Reporter:  felix     |       Owner:  felix                         
      Type:  defect    |      Status:  new                           
  Priority:  major     |   Milestone:  4.7.0                         
 Component:  expander  |     Version:  4.6.x                         
Resolution:            |    Keywords:  define-syntax begin-for-syntax
-----------------------+----------------------------------------------------

Comment(by sjamaan):

 OK, I got it to work in the interpreter. Here's a simple testcase:

 {{{
 (module foo (listify)
   (import chicken scheme)
   (begin-for-syntax
    (define-syntax call-it-123
      (syntax-rules ()
        ((_ x)
         '(x 'x 1 2 3)))))
   (define-syntax listify
     (lambda (e r c)
       (call-it-123 list))))

 (import foo)
 (print (listify))
 }}}

 The patch works because while expanding the body of a macro, the macro
 environment should be that of the meta-macro-environment, but inside the
 thunk that is the second argument to dynamic-wind the macro-environment
 has already been tweaked to point to what was previously the meta-macro-
 environment. (at least, I think that's what's happening)

 I can't get it to work in the compiler for some reason.  I've replaced the
 compiler's eval/meta to have the same code as in eval.scm (which is more
 careful in restoring the various environments and works differently to a
 regular parameterize), but that didn't help :(

-- 
Ticket URL: <https://bugs.call-cc.org/ticket/504#comment:3>
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]