From 8a93eeb52bd7c98c5a060ca019bdc8f4c5a0b09c Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Mon, 31 Mar 2014 23:19:48 -0400 Subject: [PATCH] Real fix for the issue in the math docs Commit 92b0e86ed1cf0270730c004211387b3fdc4b0469 turns out to have been the wrong approach, because there was no mysterious performance problem with TR. Instead, TR's `define` expanded to new code that interacted poorly with a macro used in the math docs. I've kept the refactoring from that commit because I think it still makes the code clearer, but I've removed the now extraneous comment. --- pkgs/math-pkgs/math-doc/math/scribblings/rename-defines.rkt | 4 +++- .../typed-racket-lib/typed-racket/base-env/prims.rkt | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkgs/math-pkgs/math-doc/math/scribblings/rename-defines.rkt b/pkgs/math-pkgs/math-doc/math/scribblings/rename-defines.rkt index b9e2f5e4e2..4e41035889 100644 --- a/pkgs/math-pkgs/math-doc/math/scribblings/rename-defines.rkt +++ b/pkgs/math-pkgs/math-doc/math/scribblings/rename-defines.rkt @@ -9,11 +9,13 @@ (syntax-case stx () [(_ e) (let ([expanded (local-expand #'e (syntax-local-context) #f)]) - (syntax-case expanded (define-values) + (syntax-case expanded (define-values begin) [(define-values (x ...) expr) (with-syntax ([(y ...) (generate-temporaries #'(x ...))]) (syntax/loc stx (begin (define-syntax x (make-rename-transformer #'y)) ... (define-values (y ...) expr))))] + [(begin e ...) + #'(begin (rename-defines e) ...)] [_ #'e]))])) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/base-env/prims.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/base-env/prims.rkt index 59d63c60be..6c07a59fe3 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/base-env/prims.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/base-env/prims.rkt @@ -1221,10 +1221,6 @@ This file defines two sorts of primitives. All of them are provided into any mod ;; the first three cases are actually subsumed by the last, ;; but manually expanding to using the : annotation form ;; produces better error messages on duplicate annotations - ;; - ;; note, these first two cases can be collapsed into one - ;; but we keep them separate because in some cases it ruins - ;; typechecking performance to merge them. [(-define nm:id body) (syntax/loc stx (define nm body))] [(-define nm:id return:return-ann body)