[plt-dev] Re: [plt] Push #20372: master branch updated

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri May 28 21:51:23 EDT 2010

On Fri, May 28, 2010 at 9:21 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
>> -      [else (loop (- i 1)
>> +      [else (loop (sub1 i)
>
> Okay, I'll bite. Why does (- i 1) do something different than (sub1
> i)? Is sub1 overloaded in some useful way that - cannot be? Or is it
> something about the constant?

`sub1' has the type, among others, of:

 (Exact-Positive-Integer -> Exact-Nonnegative-Integer)

In this example, `i' (the argument to `loop') has argument type
`Exact-Nonnegative-Integer'.  But above that line, we've tested that
`i' isn't 0.  So `i' is an `Exact-Positive-Integer'.  So the `sub1'
call produces exactly the right type for the call to `loop'.  `-'
can't have a type that does that, unless we special-case 1.

-- 
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.