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.

Component equivalence is determined nominally to allow mutually recursive linking of components. By programmer<br />

convention, identifiers associated with components that are not included in the <strong>Fortress</strong> standard libraries begin with<br />

the reverse of the URL of the development team. A fortress does not allow the installation of distinct components with<br />

the same name. Component names are used during link and upgrade operations to ensure that the restrictions on<br />

upgrades to a component are respected, as explained in Section 22.7.<br />

Every component also includes a vendor name, the name of the fortress it is compiled on, and a timestamp, denoting<br />

the time of compilation. <strong>The</strong> time of compilation is measured by the compiling fortress, and the name of the fortress<br />

is provided by the fortress automatically. Every timestamp issued by a fortress must be unique. <strong>The</strong> vendor name<br />

typically remains the same throughout a significant portion of the life of a user account, and is best provided as a user<br />

environment variable.<br />

In our examples, we use published descriptions of packages in the Java 6.0 API [26] as examples of APIs expressible<br />

in our component system. We use, as names for these APIs, the names of the corresponding Java packages, with<br />

java replaced with <strong>Fortress</strong>. For example, the following is the beginning of a source file for a fictional application<br />

IronCrypto:<br />

component Com.Sun.IronCrypto<br />

import <strong>Fortress</strong>.IO<br />

import <strong>Fortress</strong>.Security<br />

export <strong>Fortress</strong>.Crypto<br />

. . .<br />

end<br />

22.3 APIs<br />

Syntax:<br />

Api ::= api DottedId Import ∗ AbsDecl ∗ end<br />

AbsDecl ::= AbsTraitDecl<br />

| AbsObjectDecl<br />

| AbsFnDecl<br />

| AbsVarDecl<br />

| AbsDimUnitDecl<br />

| AbsTypeAlias<br />

| TestDecl<br />

| PropertyDecl<br />

AbsTraitDecl ::= TraitHeader (AbsMdDecl | AbsCoercion | ApiFldDecl | PropertyDecl) ∗ end<br />

AbsObjectDecl ::= ObjectHeader (AbsMdDecl | AbsCoercion | ApiFldDecl | PropertyDecl) ∗ end<br />

AbsCoercion ::= [widening ]coercion [StaticParams](Id IsType)CoercionClauses<br />

ApiFldDecl ::= ApiFldMod ∗ Id IsType<br />

ApiFldMod ::= hidden | settable | UniversalMod<br />

AbsVarDecl ::= VarWTypes<br />

| VarWoTypes : TypeRef ...<br />

| VarWoTypes : SimpleTupleType<br />

AbsDimUnitDecl ::= dim Id [default Unit]<br />

| (unit | SI unit ) Id + [ : DimRef ]<br />

| dim Id (unit | SI unit ) Id +<br />

AbsTypeAlias ::= type Id [StaticParams]<br />

APIs are compiled from special API definitions. <strong>The</strong>se are source files which declare the entities declared by the API,<br />

the names of all APIs referred to by those declarations, and prose documentation. In short, the source code of an API<br />

165

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

Saved successfully!

Ooh no, something went wrong!