[plt-scheme] (typeof obj)

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Jun 11 18:02:36 EDT 2007

On 6/11/07, Carl Eastlund <cce at ccs.neu.edu> wrote:
> On 6/11/07, YC <yinso.chen at gmail.com> wrote:
> >
> > On the other hand, if int is a subtype of number, shouldn't a number ->
> > number function suffice as its definition as it can return int -> int as
> > well?
>
> Not at all.  The function (lambda (x) 3.7) qualifies as a number ->
> number function, but it is not int -> int.  Calling add1 a number ->
> number function throws away valuable information about how it can be
> used on integers, positive numbers, and so forth.

Stepping back on level, the fallacy there was that a < b does not mean
a -> c < b -> c. That is, subtyping has to reverse for the domain of a
function.

Robby


Posted on the users mailing list.