[racket] TR error message

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Sep 23 13:59:28 EDT 2010

I think a little English would go a long way in the example below. For
example, you could write "could not find a type for + that matched the
arguments and results. A type for + are real * -> real, but there are
more specialized types that say more about the inputs and outputs.
Here they are: ... long list with newlines ...."


On Thu, Sep 23, 2010 at 12:48 PM, Vincent St-Amour <stamourv at ccs.neu.edu> wrote:
> At Thu, 23 Sep 2010 13:32:42 -0400,
> Matthias Felleisen wrote:
>> You do want to see more than the general
>> case when you are trying to eliminate
>> casts from your numeric programs. I am
>> not sure showing just the general case
>> suffices.
> In the case of comparisons, since, if we ignore filters, all the
> domains (Fixnum PositiveFixnum, Integer Natural, etc.) can be
> generalized to Real Real *. Since the return type is the same
> (Boolean) in all cases, only showing the general case does not cause
> any loss of information.
> In the case of + and others, since the return types of all the cases
> are different (Integer Integer -> Integer, Float Float -> Float,
> etc.), no case is more general (in a subtyping sense) than the others,
> so they are not eliminated.
> However, we do restrict the domains shown for errors related to +, but
> in another way: we only show the domains for which the return type is
> consistent with the expected type (the return type has to be a subtype
> of the expected type). That means that you see the domains that would
> give you a value of the required type: these are cases where you don't
> need casts.
> So right now, if you have the following code:
> (+ 'a 'b)
> with an expected type of Integer, the error only mentions the domains
> for which the return type would be Integer, but it mentions all of
> them, and it ignores the cases that would result in a Float, or a
> Complex.
> Vincent
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Posted on the users mailing list.