19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

This method runs all test functions defined in the component. All test functions are run in parallel; each test function<br />

is run for each combination of test cases (bound in its generator list as described in Section 19.2) in parallel. In the<br />

case of a compound component, the set of defined test functions consists of all test functions defined by all constituent<br />

components and by all exported APIs. <strong>The</strong> set of test functions run can be limited by first hiding the tested component<br />

in a more restrictive API. <strong>The</strong> set of test functions can also be expanded by linking with a component defining<br />

additional test functions.<br />

<strong>The</strong> runTests method includes a keyword parameter inclusive that defaults to true . If this parameter is set to false ,<br />

only test functions defined in the APIs exported by the component are run.<br />

22.8 Advanced Features of <strong>Fortress</strong> Operations<br />

<strong>The</strong> system we have described thus far provides much of the desired functionality of a component system. However it<br />

has a few significant weaknesses:<br />

1. It exposes to everyone all the APIs used in the development of a project.<br />

2. By allowing access to these APIs, it inhibits significant cross-component optimization.<br />

3. It prevents components that use two different implementations of the same API from being linked, even if they<br />

never actually pass references to that API between each other.<br />

4. It restricts the upgradability of compound components, as described earlier.<br />

We can mitigate all these shortcomings by providing two simple operations, hide and constrain. Informally, hide<br />

makes APIs no longer visible from outside the component so that they cannot be upgraded, and constrain merely<br />

prevents them from being exported. An API that is constrained but not hidden can still be upgraded. <strong>The</strong>re are other<br />

subtle consequences of this distinction, which we discuss as they arise.<br />

Some of the properties about the APIs exported by a component discussed in Section 22.7 are actually properties of<br />

APIs that are visible or provided by a component. For example, APIs visible in a component cannot be imported by<br />

that component, even if they are not exported. Other properties are really properties only of the exported APIs. Most<br />

importantly, components that do not export any common APIs can be linked, as can components that share only visible<br />

APIs.<br />

Constrain A constrain operation takes a component name of an installed component, a new component name,<br />

and a set of APIs, and produces a new component that does not export any of the APIs specified. Syntactically, we<br />

write:<br />

constrain(source:String, destination = source, apis:Set[\String\]):()<br />

If no destination name is provided, the name of the source is used.<br />

<strong>The</strong> set of APIs provided must be a subset of the APIs exported by the component. Also, recall that every API used<br />

by an API exported by a component must be imported or exported by that component. Thus, if we constrain an API<br />

that is used by any other API exported by the component, then we must also constrain that other API.<br />

If the component is a simple component, we first link it by itself, and then apply constrain to the result.<br />

Hide A hide operation is like a constrain operation, except that the given set of APIs is subtracted from the<br />

visible and provided APIs, along with the exported APIs, in the resulting component.<br />

hide(source:String, destination = source, apis:Set[\String\]):()<br />

175

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

Saved successfully!

Ooh no, something went wrong!