On Mon, Aug 23, 2010 at 8:58 PM, Neil Toronto <[email protected]> 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
[email protected]
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to