Re: [racket-users] [Type Racket] Why doesn't this code type check?

2019-12-21 Thread Sam Tobin-Hochstadt
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 wrote: > Hi guys, thanks for your attention. Here is the code. > > 1 (: n (U

[racket-users] [Type Racket] Why doesn't this code type check?

2019-12-21 Thread Weixi Ma
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