19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

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.

nonprimed types and static arguments before the termination of type inference. We abuse notation by using types to<br />

refer to both types and static arguments when it is clear from context.<br />

First, we annotate every expression e that is not a functional application with a fresh static variable (written here as a<br />

superscript):<br />

e T ′<br />

and every functional application f(a 0 , ..., a n ) (where f is the name of a generic functional) with fresh static variables<br />

for the instantiation of each of the functional’s static parameters as well as a superscript:<br />

fT ′ 0, ..., T ′ m−1(a 0 , ..., a n ) T ′ m<br />

and every functional parameter x without a declared type with fresh static variable as its declared type:<br />

x:T ′<br />

We say that a functional application is an outermost functional application if and only if it is not a proper subexpression<br />

of another functional application.<br />

For each outermost functional application:<br />

fT ′ 0, ..., T ′ m−1(a 0 , ..., a n ) T ′ m<br />

let fR 0 , ..., R m−1 (p 0 :S 0 , ..., p n :S n ):R m be a declaration of f. Some of the types and static parameters appearing<br />

at the declaration might be primed static variables themselves.<br />

Note that there may be several declarations of f due to overloading. When there are multiple declarations for f, type<br />

inference is performed to each declaration. Only the declarations to which type inference succeed are considered for<br />

overload resolution.<br />

We accumulate a table of subtyping constraints as follows:<br />

First, we add the following constraint to our table:<br />

T ′ m

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

Saved successfully!

Ooh no, something went wrong!