[racket] TR error message

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Tue Sep 21 23:41:55 EDT 2010

At Tue, 21 Sep 2010 23:04:04 -0400,
Sam Tobin-Hochstadt wrote:
> On Tue, Sep 21, 2010 at 10:31 PM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
> >
> > On Sep 21, 2010, at 9:01 PM, Shriram Krishnamurthi wrote:
> >
> >> If so why are many of the combinations missing?
> >
> > Because this is work in progress to support typed-based optimizations. Roughly speaking, with types TR can macro-generate code that exploits Racket's specialized primitives to an extent that eliminates a large amount of overhead -- for certain numeric programs.
> Right - all of those different cases inform the optimizer of different
> properties.

These do help with optimization, but the main reason to have all these
cases is because of the filters that are associated with each case,
which lead to more precise types in general.

For instance, this program:
(: f (Integer -> Natural))
(define (f x)
  (if (>= x 5) (+ x 3) 4))
typechecks because the type system knows that if x is greater than or
equal to 5, it has to be a natural number. Depending on the types of
the arguments to the comparison, the result of the comparison can
refine the types of the arguments.


Posted on the users mailing list.