minor field contract clarifications

This commit is contained in:
Robby Findler 2013-04-28 18:19:13 -05:00
parent 60610b737d
commit 3dbc3060f6

View File

@ -1811,10 +1811,11 @@ The external contracts are as follows:
(send (new woody+c%) draw #f)] (send (new woody+c%) draw #f)]
} }
@item{An external field contract, tagged with @racket[field], describes the @item{An external field contract, tagged with @racket[field], describes the
behavior of the value contained in that field when accessed via an behavior of the value contained in that field when accessed from outside
object of that class. Since fields may be mutated, these contracts the class. Since fields may be mutated, these contracts
are checked on any external access and/or mutation of the field. are checked on any external access (via @racket[get-field])
and external mutations (via @racket[set-field!]) of the field.
@defexamples[#:eval @defexamples[#:eval
class-eval class-eval
(define woody/hat% (define woody/hat%
@ -1834,7 +1835,9 @@ The external contracts are as follows:
(let ([woody (new woody/hat+c%)]) (let ([woody (new woody/hat+c%)])
(send woody lose-hat) (send woody lose-hat)
(get-field hat-location woody)) (get-field hat-location woody))
(get-field hat-location (new woody/hat+c%))] (get-field hat-location (new woody/hat+c%))
(let ([woody (new woody/hat+c%)])
(set-field! hat-location woody 'under-the-dresser))]
} }
@item{An initialization argument contract, tagged with @racket[init], @item{An initialization argument contract, tagged with @racket[init],