Program 



Find in Program 



Page 



Basket 


view, help
"ObjectOriented Units of Measurement"




ObjectOriented Units of Measurement
Ballroom AB Thursday, 11:30, 30 minutes 7  ·  8  ·  9  ·  10  ·  11  ·  12  ·  13  ·  14  ·  15  ·  16  ·  17  ·  18  ·  19  ·  20  ·  21 
Eric Allen, Sun Microsystems David Chase, Sun Microsystems Victor Luchangco, Sun Microsystems JanWillem Maessen, Sun Microsystems Guy Steele, Sun Microsystems
Programs that manipulate physical quantities typically represent these
quantities as raw numbers corresponding to the quantities' measurement
in a particular unit (e.g., a length represented as a number of meters).
This approach eliminates the possibility of catching errors resulting
from adding or comparing quantities expressed in different units (as in
the Mars Climate Orbiter), and does not support \emph{dimensional analysis},
a powerful form of static checking on expressions of physical quantities.
We show how to formulate dimensions and units as classes in a (nominally
typed) objectoriented language through the use of statically typed
metaclasses. Our formulation allows both parametric and inheritance
polymorphism with respect to both dimension and unit types. It also
allows for integration of encapsulated measurement systems, dynamic
conversion factors, and declarations of scales (including nonlinear
scales) with defined zeros, and nonconstant exponents on dimension types.
Finally, we show how to encapsulate most of the "magic machinery" that
handles the algebraic nature of dimensional units in a single metaclass
that allows us to treat select static types as generators of a free abelian
group.
