improved fix, Matthew's suggestion
please merge into 6.1.1
This commit is contained in:
parent
22d9e36150
commit
923a785867
|
@ -29,8 +29,7 @@
|
||||||
(provide kw ...)
|
(provide kw ...)
|
||||||
(define-syntaxes (kw ...)
|
(define-syntaxes (kw ...)
|
||||||
(values
|
(values
|
||||||
(lambda (x)
|
(lambda (x) 'kw (raise-syntax-error #f "used out of context" x))
|
||||||
(raise-syntax-error (if (equal? 'kw x) 'kw 'kw-alt) "used out of context" x))
|
|
||||||
...))
|
...))
|
||||||
|
|
||||||
;; a macro for creating functions that instantiate the proper object
|
;; a macro for creating functions that instantiate the proper object
|
||||||
|
@ -48,11 +47,4 @@
|
||||||
#`(lambda (%)
|
#`(lambda (%)
|
||||||
(lambda #,(args para*)
|
(lambda #,(args para*)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(new % #,@(body para*)))))))]))))]))
|
(new % #,@(body para*)))))))]))))]))
|
||||||
|
|
||||||
#;
|
|
||||||
(define-keywords
|
|
||||||
new-world
|
|
||||||
'()
|
|
||||||
define-create
|
|
||||||
(on-draw to-draw DEFAULT #'#f values))
|
|
|
@ -16,6 +16,52 @@
|
||||||
(namespace-anchor->namespace an))
|
(namespace-anchor->namespace an))
|
||||||
(error 'to-draw "got no error message"))
|
(error 'to-draw "got no error message"))
|
||||||
|
|
||||||
;; known problem with the solution:
|
(with-handlers ([exn:fail:syntax?
|
||||||
;; (to-draw on-draw)
|
;; succeed quietly if
|
||||||
;; will signal the wrong kind of error
|
(lambda (x)
|
||||||
|
(unless (regexp-match? "^to-draw" (exn-message x))
|
||||||
|
(error 'to-draw "got wrong error message: ~e" (exn-message x))))])
|
||||||
|
(eval
|
||||||
|
'(module test racket
|
||||||
|
(require 2htdp/universe)
|
||||||
|
(to-draw on-draw))
|
||||||
|
(namespace-anchor->namespace an))
|
||||||
|
(error 'to-draw "got no error message"))
|
||||||
|
|
||||||
|
(with-handlers ([exn:fail:syntax?
|
||||||
|
;; succeed quietly if
|
||||||
|
(lambda (x)
|
||||||
|
(unless (regexp-match? "^to-draw" (exn-message x))
|
||||||
|
(error 'to-draw "got wrong error message: ~e" (exn-message x))))])
|
||||||
|
(eval
|
||||||
|
'(module test racket
|
||||||
|
(require 2htdp/universe)
|
||||||
|
(big-bang 0 (on-draw to-draw)))
|
||||||
|
(namespace-anchor->namespace an))
|
||||||
|
(error 'to-draw "got no error message"))
|
||||||
|
|
||||||
|
;; it still works okay for on-draw
|
||||||
|
|
||||||
|
(with-handlers ([exn:fail:syntax?
|
||||||
|
;; succeed quietly if
|
||||||
|
(lambda (x)
|
||||||
|
(unless (regexp-match? "^on-draw" (exn-message x))
|
||||||
|
(error 'on-draw "got wrong error message: ~e" (exn-message x))))])
|
||||||
|
(eval
|
||||||
|
'(module test racket
|
||||||
|
(require 2htdp/universe)
|
||||||
|
(on-draw to-draw))
|
||||||
|
(namespace-anchor->namespace an))
|
||||||
|
(error 'on-draw "got no error message"))
|
||||||
|
|
||||||
|
(with-handlers ([exn:fail:syntax?
|
||||||
|
;; succeed quietly if
|
||||||
|
(lambda (x)
|
||||||
|
(unless (regexp-match? "^on-draw" (exn-message x))
|
||||||
|
(error 'on-draw "got wrong error message: ~e" (exn-message x))))])
|
||||||
|
(eval
|
||||||
|
'(module test racket
|
||||||
|
(require 2htdp/universe)
|
||||||
|
(big-bang 0 (to-draw on-draw)))
|
||||||
|
(namespace-anchor->namespace an))
|
||||||
|
(error 'to-draw "got no error message"))
|
Loading…
Reference in New Issue
Block a user