[racket] Typed Racket reactions on developing polymorphic typed array library, and questions

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Mon Aug 23 21:17:21 EDT 2010

On Mon, Aug 23, 2010 at 8:58 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
>
> It would be nice if assert were capable of this. To do that, though, I think
> the type checker would have to treat the expression after the "if" in this
> case:
>
>    (begin (if (pred? x)
>               <something useful>
>               (error ...))
>           <some other useful thing...>)
>
> as part of the "then" branch. (And as part of the "else" branch when the
> error is in the "then".)

This is something I've wanted for a while.  It comes up a lot in code like this:

(unless (foo? x) (error 'bad-input))
(foo-fun x)

It requires some involved-but-I-hope-straightforward to the machinery
of occurrence typing, but it's something I plan to add eventually.
-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.