In typed racket (- 1 1) and (- 2 2) are equal at runtime, but the type checker doesn't necessarily know that at compile time. It knows that (- 1 1) is zero because that's a special case in the type system. But it doesn't have a special case for (- 2 2), so it only knows that that's a Fixnum.
Alex Knauth > On Dec 10, 2015, at 12:26 PM, Klaus Ostermann <klaus...@gmail.com> wrote: > > This Typed Racket term is well-typed: > > (+ 1 (if (= 0 (- 1 1)) 1 "x")) > > This one isn't: > > (+ 1 (if (= 0 (- 2 2)) 1 "x")) > > This looks a bit strange to me, because usually one would expect > well-typedness to be not destroyed by replacing "equals with equals". > > I'd like to know the rationale for this design. It would be nice if one of > the designers could comment on this. -- 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. For more options, visit https://groups.google.com/d/optout.