commit 1653e461398434fdbfe7a9459ffe5b0b99de27af
parent 84e2fd98d7be69d4cb2bcd68ae28752888fec2bb
Author: Georges Dupéron <georges.duperon@gmail.com>
Date: Mon, 26 Mar 2018 21:12:33 +0200
Compatibility with Racket 7
Diffstat:
2 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/info.rkt b/info.rkt
@@ -8,7 +8,8 @@
"stxparse-info"
"alexis-util"
"scope-operations"
- "auto-syntax-e"))
+ "auto-syntax-e"
+ "version-case"))
(define build-deps '("scribble-lib"
"racket-doc"
"scribble-math"))
diff --git a/test/assumption-weak-hash.rkt b/test/assumption-weak-hash.rkt
@@ -5,7 +5,8 @@
;; memory leaks.
(require (for-syntax racket/private/sc)
- rackunit)
+ rackunit
+ version-case)
(define h (make-weak-hasheq))
@@ -31,8 +32,13 @@
(collect-garbage)
(hh)))))))
-;; but not if the syntax object is a constant, e.g. #'(1 2 3)
-(check-pred all-eq?
+;; but not if the syntax object is a constant, e.g. #'(1 2 3), in Racket < 6.7
+;; I'm not sure how this affects subtemplate in Racket ≥ 6.7, but I suppose it
+;; is not a problem, as the beahviour is the same as in the general case where
+;; the syntax object is not constant.
+(check-pred (version-case
+ [(version< (version) "6.90") all-eq?]
+ [else (negate all-eq?)])
(for/list ([range-a (in-range 5)])
(with-syntax ([(xᵢ ...) #'(1 2 3)]) ;; CHANGED THIS LINE
(define-syntax (hh stx)
@@ -46,9 +52,14 @@
(collect-garbage)
(hh))))))
-;; nor it the same syntax object is reuqes
+;; nor it the same syntax object is reused, in Racket < 6.7
+;; I'm not sure how this affects subtemplate in Racket ≥ 6.7, but I suppose it
+;; is not a problem, as the beahviour is the same as in the general case where
+;; the syntax object is not shared.
(define stxobj (datum->syntax #'here '(1 2 3))) ;; cached stxobj here
-(check-pred all-eq?
+(check-pred (version-case
+ [(version< (version) "6.90") all-eq?]
+ [else (negate all-eq?)])
(for/list ([range-a (in-range 5)])
(with-syntax ([(xᵢ ...) stxobj]) ;; CHANGED THIS LINE
(define-syntax (hh stx)
@@ -70,6 +81,9 @@
;; (datum->syntax #'here '(1 2 3))
;; I expected the result to always be different at each execution of the
;; with-syntax, but it turns out the syntax object is kept as-is.
+;;
+;; With racket ≥ 6.7, the syntax object is different, i.e. not eq?, in every
+;; invocation of with-syntax.
(begin
(let ()
(define old1 #f)
@@ -81,11 +95,15 @@
(with-syntax ([(xᵢ ...) #'(1 2 3)])
(define-syntax (hh stx)
#`#,(syntax-mapping-valvar (syntax-local-value #'xᵢ)))
- (unless old1
- ;; Initial set!
- (set! old1 (hh)))
- (andmap identity (for/list ([range-b (in-range 5)])
- (eq? old1 hh))))))))
+ (if (not old1)
+ ;; Initial set!
+ (set! old1 (hh))
+ (andmap identity (for/list ([range-b (in-range 5)])
+ ((version-case
+ [(version< (version) "6.90") eq?]
+ [else (negate eq?)])
+ old1
+ (hh))))))))))
(let ()
(define old2 #f)