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.

Chapter 18<br />

Dimensions and Units<br />

Syntax:<br />

DimType ::= DimRef<br />

| TypeRef DimRef | TypeRef · DimRef<br />

| TypeRef / DimRef | TypeRef per DimRef<br />

| TypeRef UnitRef | TypeRef · UnitRef<br />

| TypeRef / UnitRef | TypeRef per UnitRef<br />

| TypeRef in DimRef<br />

DimRef ::= Unity<br />

| DottedId<br />

| DimRef DimRef | DimRef · DimRef<br />

| DimRef / DimRef | DimRef per DimRef<br />

| DimRef ˆ NatRef | 1 / DimRef | (DimRef )<br />

| DUPreOp DimRef | DimRef DUPostOp<br />

DUPreOp ::= square | cubic | inverse<br />

DUPostOp ::= squared | cubed<br />

UnitExpr ::= UnitRef<br />

| Expr UnitRef | Expr · UnitRef<br />

| Expr / UnitRef | Expr per UnitRef<br />

| Expr in UnitRef<br />

UnitRef ::= dimensionless<br />

| DottedId<br />

| UnitRef UnitRef | UnitRef · UnitRef<br />

| UnitRef / UnitRef | UnitRef per UnitRef<br />

| UnitRef ˆNatRef | 1/ UnitRef | (UnitRef )<br />

| DUPreOp UnitRef | UnitRef DUPostOp<br />

<strong>The</strong>re are special type-like constructs called dimensions that are separate from other types (described in Chapter 8).<br />

<strong>The</strong>re are also special constructs that modify types and values called units that are instances of dimensions. <strong>The</strong>se are<br />

used to describe physical quantities.<br />

<strong>The</strong> <strong>Fortress</strong> standard libraries define dimensions and units for the standard SI system of measurement based on meters,<br />

kilograms, seconds, amperes, and so on (as described in Section 29.1). <strong>The</strong> <strong>Fortress</strong> standard libraries also provide<br />

supplemental units of measurement, such as feet and miles (as described in Section 29.2). For example, the <strong>Fortress</strong><br />

standard libraries provide a dimension named Length whose default unit is named meter and abbreviated m_. By<br />

rendering convention, this abbreviation is rendered in roman type without the underscore: m . In contrast, the variable<br />

m is rendered as in standard mathematical notation: m . See Section 5.17 for a discussion of formatting conventions<br />

146

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

Saved successfully!

Ooh no, something went wrong!