[[email protected]: Re: Bug in psyntax wrt module/toplevel binding conflicts?]

"Scott G. Miller" <[email protected]> Wed, 13 Oct 2004 18:18:09 -0500
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
----- Forwarded message from "R. Kent Dybvig" <[email protected]> -----

Envelope-to: scgmille@localhost
Delivery-date: Wed, 13 Oct 2004 17:01:41 -0500
X-Envelope-To: [email protected]
From: "R. Kent Dybvig" <[email protected]>
To: [email protected]
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 -----

--
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBbbexr9IW4v3mHtQRAviBAJ9yq2l7wXDGKNDaEcmGJEl2iWe6dwCeP6G2
B5gqGRATnTy3prhqAzkYn8Q=
=hkyA
-----END PGP SIGNATURE-----