|
|
@ -2,19 +2,10 @@
|
|
|
|
(require (for-syntax racket/base) pollen/tag)
|
|
|
|
(require (for-syntax racket/base) pollen/tag)
|
|
|
|
(provide def/c (rename-out (top~ #%top)))
|
|
|
|
(provide def/c (rename-out (top~ #%top)))
|
|
|
|
|
|
|
|
|
|
|
|
;; Changes the default behavior of #%top.
|
|
|
|
|
|
|
|
;; Unbound identifiers are allowed, and treated as the
|
|
|
|
|
|
|
|
;; tag in a txexpr (with the rest of the expression treated as the body)
|
|
|
|
|
|
|
|
;; To suppress this behavior, use def/c to wrap any name.
|
|
|
|
|
|
|
|
;; If that name isn't already defined, you'll get the usual syntax error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (top~ . ID)
|
|
|
|
(define-syntax-rule (top~ . ID)
|
|
|
|
;; #%app shouldn't be necessary, but temp fix for Racket7
|
|
|
|
|
|
|
|
(#%app make-default-tag-function 'ID))
|
|
|
|
(#%app make-default-tag-function 'ID))
|
|
|
|
|
|
|
|
|
|
|
|
(define-syntax (def/c stx)
|
|
|
|
(define-syntax (def/c stx)
|
|
|
|
(syntax-case stx ()
|
|
|
|
(syntax-case stx ()
|
|
|
|
[(_ X)
|
|
|
|
[(_ X) (identifier-binding #'X) #'X]
|
|
|
|
(if (identifier-binding #'X )
|
|
|
|
[(_ X) #'(#%top . X)]))
|
|
|
|
#'X
|
|
|
|
|
|
|
|
#'(#%top . X))]))
|
|
|
|
|