Permalink
Browse files

Allow `#:opaque` and `#:struct` in `require/typed`.

  • Loading branch information...
1 parent daed2aa commit 9054d0db7dee7d523b6a56a1cb68d703c3426f6f @samth samth committed Oct 8, 2012
@@ -101,18 +101,15 @@ This file defines two sorts of primitives. All of them are provided into any mod
(define-syntax-class (struct-clause legacy)
;#:literals (struct)
#:attributes (nm (body 1) (constructor-parts 1))
- (pattern [struct nm:opt-parent (body ...) (~var constructor (opt-constructor legacy #'nm.nm))]
- #:fail-unless (eq? 'struct (syntax-e #'struct)) #f
+ (pattern [(~or (~datum struct) #:struct) nm:opt-parent (body ...) (~var constructor (opt-constructor legacy #'nm.nm))]
#:with (constructor-parts ...) #'constructor.value))
(define-syntax-class opaque-clause
;#:literals (opaque)
#:attributes (ty pred opt)
- (pattern [opaque ty:id pred:id]
- #:fail-unless (eq? 'opaque (syntax-e #'opaque)) #f
+ (pattern [(~or (~datum opaque) #:opaque) ty:id pred:id]
#:with opt #'())
- (pattern [opaque ty:id pred:id #:name-exists]
- #:fail-unless (eq? 'opaque (syntax-e #'opaque)) #f
+ (pattern [(~or (~datum opaque) #:opaque) opaque ty:id pred:id #:name-exists]
#:with opt #'(#:name-exists)))
(define-syntax-class (clause legacy lib)
@@ -340,14 +340,14 @@ contexts.
Here, @racket[_m] is a module spec, @racket[_pred] is an identifier
naming a predicate, and @racket[_r] is an optionally-renamed identifier.
-@defform/subs[#:literals (struct opaque)
+@defform/subs[#:literals (struct)
(require/typed m rt-clause ...)
([rt-clause [r t]
- [struct name ([f : t] ...)
+ [#:struct name ([f : t] ...)
struct-option ...]
- [struct (name parent) ([f : t] ...)
+ [#:struct (name parent) ([f : t] ...)
struct-option ...]
- [opaque t pred]]
+ [#:opaque t pred]]
[struct-option
(code:line #:constructor-name constructor-id)
(code:line #:extra-constructor-name constructor-id)])]

0 comments on commit 9054d0d

Please sign in to comment.