23.11.2014 Views

2006 Scheme and Functional Programming Papers, University of

2006 Scheme and Functional Programming Papers, University of

2006 Scheme and Functional Programming Papers, University of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

let id (T:*) (x:T) : T = x;<br />

The traditional limitation <strong>of</strong> both first-class types <strong>and</strong><br />

unrestricted refinement types is that they are not statically<br />

decidable. Sage circumvents this difficulty by replacing<br />

static type checking with hybrid type checking [14]. Sage<br />

checks correctness properties <strong>and</strong> detects defects statically,<br />

whenever possible. However, it resorts to dynamic checking<br />

for particularly complicated specifications. The overall result<br />

is that precise specifications can be enforced, with most<br />

errors detected at compile time, <strong>and</strong> violations <strong>of</strong> some complicated<br />

specifications detected at run time.<br />

1.1 Hybrid Type Checking<br />

We briefly illustrate the key idea <strong>of</strong> hybrid type checking by<br />

considering the function application<br />

(factorial t)<br />

Suppose factorial has type Pos → Pos, where Pos =<br />

{x : Int | x > 0} is the type <strong>of</strong> positive integers, <strong>and</strong> that<br />

t has some type T . If the type checker can prove (or refute)<br />

that T

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!