Add error checking for contracted form, also added documentation in reference
svn: r13135
This commit is contained in:
parent
4ca79e31ff
commit
dbe366c6a0
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
(provide only except prefix rename tag
|
(provide only except prefix rename tag
|
||||||
import export init-depend link
|
import export init-depend link
|
||||||
extends)
|
extends contracted)
|
||||||
|
|
||||||
(define-syntax-rule (define-syntax-for-error name message)
|
(define-syntax-rule (define-syntax-for-error name message)
|
||||||
(define-syntax name
|
(define-syntax name
|
||||||
|
@ -34,3 +34,5 @@
|
||||||
"misuse of compound-unit keyword")
|
"misuse of compound-unit keyword")
|
||||||
(define-syntax-for-error extends
|
(define-syntax-for-error extends
|
||||||
"misuse of define-signature keyword")
|
"misuse of define-signature keyword")
|
||||||
|
(define-syntax-for-error contracted
|
||||||
|
"misuse of define-signature keyword")
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
(provide define-signature-form struct open
|
(provide define-signature-form struct open
|
||||||
define-signature provide-signature-elements
|
define-signature provide-signature-elements
|
||||||
only except rename import export prefix link tag init-depend extends
|
only except rename import export prefix link tag init-depend extends contracted
|
||||||
unit?
|
unit?
|
||||||
(rename :unit unit) define-unit
|
(rename :unit unit) define-unit
|
||||||
compound-unit define-compound-unit compound-unit/infer define-compound-unit/infer
|
compound-unit define-compound-unit compound-unit/infer define-compound-unit/infer
|
||||||
|
@ -252,6 +252,13 @@
|
||||||
val-defs
|
val-defs
|
||||||
stx-defs
|
stx-defs
|
||||||
(append (syntax->list #'(z ...)) ctcs)))
|
(append (syntax->list #'(z ...)) ctcs)))
|
||||||
|
((x . z)
|
||||||
|
(and (identifier? #'x)
|
||||||
|
(module-identifier=? #'x #'contracted))
|
||||||
|
(raise-syntax-error
|
||||||
|
'define-signature
|
||||||
|
"expected a list of [id contract] pairs after the contracted keyword"
|
||||||
|
(car sig-exprs)))
|
||||||
((x . y)
|
((x . y)
|
||||||
(and (identifier? #'x)
|
(and (identifier? #'x)
|
||||||
(or (module-identifier=? #'x #'define-values)
|
(or (module-identifier=? #'x #'define-values)
|
||||||
|
|
|
@ -160,6 +160,7 @@ the corresponding import. Each @scheme[tagged-sig-id] in an
|
||||||
|
|
||||||
[sig-elem
|
[sig-elem
|
||||||
id
|
id
|
||||||
|
(contracted [id contract] ...)
|
||||||
(define-syntaxes (id ...) expr)
|
(define-syntaxes (id ...) expr)
|
||||||
(define-values (value-id ...) expr)
|
(define-values (value-id ...) expr)
|
||||||
(open sig-spec)
|
(open sig-spec)
|
||||||
|
@ -176,6 +177,15 @@ of bindings for import or export:
|
||||||
importing the signature, and @scheme[id] must be defined by units
|
importing the signature, and @scheme[id] must be defined by units
|
||||||
exporting the signature.}
|
exporting the signature.}
|
||||||
|
|
||||||
|
@item{Each @scheme[contracted] form in a signature declaration means
|
||||||
|
that a unit exporting the signature must supply a variable definition
|
||||||
|
for each @scheme[id] in that form. If the signature is imported, then
|
||||||
|
uses of @scheme[id] inside the unit are protected by the appropriate
|
||||||
|
contracts using the unit as the negative blame. If the signature is
|
||||||
|
exported, then the exported values are protected by the appropriate
|
||||||
|
contracts which use the unit as the positive blame, but internal uses
|
||||||
|
of the exported identifiers are not protected.}
|
||||||
|
|
||||||
@item{Each @scheme[define-syntaxes] form in a signature declaration
|
@item{Each @scheme[define-syntaxes] form in a signature declaration
|
||||||
introduces a macro to that is available for use in any unit that
|
introduces a macro to that is available for use in any unit that
|
||||||
imports the signature. Free variables in the definition's
|
imports the signature. Free variables in the definition's
|
||||||
|
|
Loading…
Reference in New Issue
Block a user