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.

α, β type variables<br />

f<br />

method name<br />

x<br />

field name<br />

T<br />

trait name<br />

O<br />

object name<br />

C<br />

trait or object name<br />

τ, τ ′ , τ ′′ ::= α type<br />

| σ<br />

σ ::= N type that is not a type variable<br />

| O −→ τ <br />

N, M, L ::= T −→ τ super trait<br />

| Object<br />

K, H, J ::= α bound on a type variable<br />

| N<br />

e ::= x expression<br />

| self<br />

| O −→ τ ( −→ e )<br />

| e.x<br />

| eas C −→ τ .f −→ τ ( −−−→ eas τ)as τ<br />

| typecase x = ein −−−→ τ ⇒ eelse eend<br />

−−−−−−−−−−−→<br />

fd ::= fαextends { −→ K}( −→ x:τ):τ = e<br />

method definition<br />

−−−−−−−−−−−→<br />

td ::= trait Tαextends { −→ K}extends { −→ −−−−−−−−−−−→<br />

N }where { αextends { −→ K}} −→ fd end trait definition<br />

−−−−−−−−−−−→<br />

od ::= object Oαextends { −→ K}( −→ x:τ)extends { −→ −−−−−−−−−−−→<br />

N }where { αextends { −→ K}} −→ fd end object definition<br />

d ::= td definition<br />

| od<br />

p ::= −→ d e program<br />

Figure A.6: Syntax of Core <strong>Fortress</strong> with Where Clauses<br />

A.2.3<br />

Static Semantics<br />

A static semantics for Core <strong>Fortress</strong> with Where Clauses is provided in Figures A.9, A.10, A.11, and A.12.<br />

For simplicity, we use the following conventions:<br />

• FTV (τ) collects all free type variables in τ.<br />

• Similarly, FTV (e) collects all free type variables in all types in e.<br />

We proved the type soundness of Core <strong>Fortress</strong> with Where Clauses using the standard technique of proving a progress<br />

theorem and a subject reduction theorem.<br />

319

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

Saved successfully!

Ooh no, something went wrong!