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.

<strong>The</strong> declaration of a type parameter or a unit parameter for a parameterized trait may contain a clause “absorbs unit ”;<br />

at most one static parameter of a trait may have this clause. An instance of a parameterized trait with a static parameter<br />

that “absorbs unit ” may be multiplied or divided by a unit, the result being another instance of that parameterized<br />

trait in which the static argument corresponding to the unit-absorbing parameter has been multiplied or divided by the<br />

unit.<br />

A few examples should make this clear. Given the declaration<br />

trait VectorEltType extends Number absorbs unit,nat len . . . end<br />

then VectorFloat, 3meter means the same as VectorFloat meter, 3 , and VectorFloat, 3/second means the<br />

same as VectorFloat/second, 3 . Similarly, given the declaration<br />

trait Floatunit U absorbs unit,nat e,nat s . . . end<br />

then Floatmeter, 11, 53/second means the same as Floatmeter/second, 11, 53 , and<br />

Floatdimensionless, 8, 24meter kilogram/second 2<br />

means the same as<br />

Floatdimensionless meter kilogram/second 2 , 8, 24 ,<br />

which is the same as<br />

Floatmeter kilogram/second 2 , 8, 24 .<br />

This is the mechanism by which meaning is given to the multiplication and division of library-defined types by units.<br />

240

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

Saved successfully!

Ooh no, something went wrong!