Typed Racket doesn't refine the type of mutable variables. Doing that
soundly would require an effect and escape analysis that seems like more
complexity than it's worth.

Sam

On Sat, Dec 21, 2019, 9:46 AM Weixi Ma <mvccc...@gmail.com> wrote:

> Hi guys, thanks for your attention. Here is the code.
>
> 1 (: n (U False Number))
> 2 (define n #f)
> 3 (when n
> 4   (set! n (sub1 n)))
>
> I suppose there should a refinement at line 3 that narrows down the type
> of n to be Number.
> However typed racket complains that n is expected to be Number and
> actually given (U Complex False).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/bdd02c94-e1e4-40b2-b0ba-608281c75f5a%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/bdd02c94-e1e4-40b2-b0ba-608281c75f5a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BZnsoabSbQoZ0rrwT%3DTEcP8fTh1jgi53uheQyVCX_8HHw%40mail.gmail.com.

Reply via email to