logo       
Google Custom Search
    AddThis Social Bookmark Button

[dyb@xxxxxxxxxxxxxx: Re: Bug in psyntax wrt module/toplevel binding conflic: msg#00005

Subject: [dyb@xxxxxxxxxxxxxx: Re: Bug in psyntax wrt module/toplevel binding conflicts?]
----- Forwarded message from "R. Kent Dybvig" <dyb@xxxxxxxxxxxxxx> -----

Envelope-to: scgmille@localhost
Delivery-date: Wed, 13 Oct 2004 17:01:41 -0500
X-Envelope-To: scott@xxxxxxxxxxxx
From: "R. Kent Dybvig" <dyb@xxxxxxxxxxxxxx>
To: scott@xxxxxxxxxxxx
Subject: Re: Bug in psyntax wrt module/toplevel binding conflicts?

It looks like you may be the victim of an order-of-evaluation bug.
Try changing the chi-top define-form case from:

        ((define-form)
         (parse-define e w s
           (lambda (id rhs w)
             (let ((id (wrap id w)))
               (let ((n (id-var-name id empty-wrap)))
                 (let ((b (lookup n r)))
                   (case (binding-type b)
                     ((displaced-lexical) (displaced-lexical-error id)))))
               (let ((sym (id-sym-name id)))
                 (let ((valsym (if (only-top-marked? id) sym (generate-id 
sym))))
                   (build-sequence no-source
                     (list
                       (ct-eval/residualize ctem
                         (lambda ()
                           (build-cte-install
                             (if (eq? sym valsym)
                                 sym
                                 (let ((marks (wrap-marks (syntax-object-wrap 
id))))
                                   (make-syntax-object sym
                                     (make-wrap marks
                                       (list (make-ribcage (vector sym)
                                               (vector marks) (vector 
valsym)))))))
                             (build-data no-source (make-binding 'global 
valsym)))))
                       (rt-eval/residualize rtem
                         (lambda ()
                           (build-global-definition s valsym (chi rhs r w)))))))
                )))))

to

        ((define-form)
         (parse-define e w s
           (lambda (id rhs w)
             (let ((id (wrap id w)))
               (let ((n (id-var-name id empty-wrap)))
                 (let ((b (lookup n r)))
                   (case (binding-type b)
                     ((displaced-lexical) (displaced-lexical-error id)))))
               (let ((sym (id-sym-name id)))
                 (let ((valsym (if (only-top-marked? id) sym (generate-id 
sym))))
                   (build-sequence no-source
                    ; make sure compile-time definitions occur before we
                    ; expand the run-time code
                     (let ((x (ct-eval/residualize ctem
                                (lambda ()
                                  (build-cte-install
                                    (if (eq? sym valsym)
                                        sym
                                        (let ((marks (wrap-marks 
(syntax-object-wrap id))))
                                          (make-syntax-object sym
                                            (make-wrap marks
                                              (list (make-ribcage (vector sym)
                                                      (vector marks) (vector 
valsym)))))))
                                    (build-data no-source (make-binding 'global 
valsym)))))))
                       (list
                         x
                         (rt-eval/residualize rtem
                           (lambda ()
                             (build-global-definition s valsym (chi rhs r 
w))))))))
                )))))

Kent


----- End forwarded message -----

-- 

Attachment: pgp8KtKy9kXUe.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>