Skip to content

Commit

Permalink
Bind the internal planetcute id to a gensym.
Browse files Browse the repository at this point in the history
This avoids an ambigous binding error created by the new macro system.
Fixes racket/racket#1099.

Add a test file that will be run in DrDr.
  • Loading branch information
samth committed Oct 23, 2015
1 parent 64d1ea8 commit 92167b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions htdp-lib/2htdp/planetcute.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
(if (eq? 'expression (syntax-local-context))
;; In an expression context:
(let* ([key (syntax-local-lift-context)]
[id (gensym img)]
;; Already lifted in this lifting context?
[lifted-id
(or (hash-ref saved-id-table key #f)
;; No: lift the require for the image:
(syntax-local-lift-require `(lib ,(format "~a.rkt" img) "2htdp" "planetcute")
(datum->syntax stx img)))])
(syntax-local-lift-require `(rename (lib ,(format "~a.rkt" img) "2htdp" "planetcute") ,id ,img)
(datum->syntax stx id)))])
(when key (hash-set! saved-id-table key lifted-id))
;; Expand to a use of the lifted expression:
(with-syntax ([saved-id (syntax-local-introduce lifted-id)])
Expand Down
3 changes: 3 additions & 0 deletions htdp-test/2htdp/tests/planetcute-runs.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#lang racket
(require 2htdp/planetcute)
character-cat-girl

0 comments on commit 92167b6

Please sign in to comment.