From 051966923925ba3bfaacfcc77f9d57e7fbfb2452 Mon Sep 17 00:00:00 2001 From: Stevie Strickland Date: Sun, 14 Sep 2008 06:00:48 +0000 Subject: [PATCH] Show some actual examples of how the two differ here. svn: r11743 --- collects/mzlib/scribblings/contract.scrbl | 34 ++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/collects/mzlib/scribblings/contract.scrbl b/collects/mzlib/scribblings/contract.scrbl index ba6047edbb..0ae069c2d1 100644 --- a/collects/mzlib/scribblings/contract.scrbl +++ b/collects/mzlib/scribblings/contract.scrbl @@ -1,5 +1,7 @@ #lang scribble/doc @(require "common.ss" + scheme/sandbox + scribble/eval scribble/struct (for-label mzlib/contract)) @@ -108,4 +110,34 @@ provided by @scheme[provide/contract], because @scheme[define/contract] cannot detect the name of the definition where the reference to the defined variable occurs. Instead, it uses the source location of the reference to the variable as the name of -that definition.} +that definition. + +@interaction[#:eval (parameterize ([sandbox-output 'string] + [sandbox-error-output 'string] + [sandbox-eval-limits #f]) + (make-evaluator 'mzscheme)) + (require mzlib/contract) + (define/contract f + (-> number? number?) + (lambda (x) (+ x 1))) + (define/contract g + (-> number? number?) + (lambda (x) (f #t))) + (f 4) + (f #t) + (g 4)] + +This is as opposed to the @scheme[define/contract] form from +@schememodname[scheme/contract], which gives more precise error +messages: + +@interaction[(require scheme/contract) + (define/contract f + (-> number? number?) + (lambda (x) (+ x 1))) + (define/contract g + (-> number? number?) + (lambda (x) (f #t))) + (f 4) + (f #t) + (g 4)]}