On Tue, May 24, 2011 at 1:41 PM, Richard Lawrence <[email protected]> wrote: > Sam Tobin-Hochstadt <[email protected]> > writes: > >> (assert x p?) is equivalent to (if (p? x) x (error ...)) except that >> the result is known to have the appropriate type (here `String'). > > Ah, OK, I think I see my mistake; is this the right way to put it? > Although the expression > > (assert x string?) > > has type String, and evaluates to the same value as `x' provided that > value is indeed a string, this does not mean that the expression `x' has > type String.
Right. Typed Racket doesn't, in general, handle the following idiom as usefully as it could: (begin (unless (string? x) (error ...)) (string-append x "blah")) Improving this is a long term goal for Typed Racket. -- sam th [email protected] _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

