added schemeerror and used it

svn: r8223
This commit is contained in:
Robby Findler 2008-01-05 16:46:17 +00:00
parent 8cbe9a6da9
commit 7f3a5c13c2
3 changed files with 16 additions and 7 deletions

View File

@ -227,6 +227,7 @@
schemeblockelem
schemeinput
schememod
schemeerror
scheme SCHEME scheme/form schemeresult schemeid schememodname
defmodule defmodule* defmodulelang defmodulelang*
defmodule*/no-declare defmodulelang*/no-declare
@ -305,6 +306,9 @@
(define (link url . str)
(make-element (make-target-url url) (decode-content str)))
(define (schemeerror . str)
(make-element "schemeerror" (decode-content str)))
(provide t)
(define (t . str)
(decode-paragraph str))

View File

@ -1,7 +1,6 @@
#lang scribble/doc
@require[scribble/manual]
@require[scribble/eval]
@require[scribble/struct]
@require["guide-utils.ss"]
@require["contracts-utils.ss"]
@(require (for-label scheme/contract))
@ -30,10 +29,9 @@ Several clients used your module. Others used their
modules. And all of a sudden one of them sees this error
message:
@(make-element "schemeerror"
'("bank-client broke the contract (-> ??? any)
@schemeerror{bank-client broke the contract (-> ??? any)
it had with myaccount on deposit;
expected <???>, given: -10"))
expected <???>, given: -10}
Clearly, @scheme[bank-client] is a module that uses
@scheme[myaccount] but what are the @tt{?}s doing there?
@ -64,10 +62,9 @@ scheme/base
With this little change, the error message becomes all of
sudden quite readable:
@(make-element "schemeerror"
'("bank-client broke the contract (-> amount any)
@schemeerror{bank-client broke the contract (-> amount any)
it had with myaccount on deposit;
expected <amount>, given: -10"))
expected <amount>, given: -10"}
@question[#:tag "optionals"]{Can a contract specify what the values of optional arguments to a function must be?}

View File

@ -7,6 +7,14 @@
@local-table-of-contents[]
@;{
Somewhere, discuss eq? and its impact on lists and
procedures. Also, discuss difference between contracts on
mutable datastructures & contracts on immutable ones.
}
@include-section["contracts-intro.scrbl"]
@include-section["contracts-simple-function.scrbl"]
@include-section["contracts-general-function.scrbl"]