Aconcagua

Summary: This project reifies measures as first class objects. A measure is a number with a unit
Author: Hernan Wilkinson
Owner: Hernan Wilkinson (HAW)
Co-maintainers: <None>
Categories:
Homepage:
PackageInfo name: Aconcagua
RSS feed:

Description:

A measure is a concept that groups a number and a unit.
Clear examples of measures are “1 meter”, “200 kelvin”, “1 day” or “2 dollars”.
This model represents measures as first class objects, that is, an object that encapsulates a number with its unit. This representation allows the programmer to use measures in arithmetic expressions as if they were numbers, but with the advantage of providing explicit information to the system—specifically, the measure’s units.
There are many benefits that this model provides. Among them, we can name the sense of security that it creates for the programmer when programming arithmetic expressions.
The fact that it is the system and not the programmer who must assure the result’s of any arithmetic operation regarding the units minimizes the error rate produced by the incorrect evaluation of formulas. If the programmer performs incorrect operations with measures, then this error will not go unnoticed, and the system will inform it when evaluating a mathematical expression.
Some examples:
2 * meter. -- Returns the measure 2 meters
(1 day) + (3 day) -- Returns the measure 4 * day
(10 meter) / (1 second) -- Returns the measure 10 * (meter/second)
(1 * day ) (2 * day) -- Returns true
(1 day) to: (10 day) -- Creates an interval from 1 day to 10 days every 1 day.

This model was presented at OOPSLA 2005 with a practitioner report named “Arithmetic with Measurements on Dynamically-Typed Object-Oriented Languages” by Wilkinson, H., Prieto, M., Romeo, L., Companion Booklet of the 20th annual ACM SIGPLAN Conference on Object-oriented programming, systems, languages, and applications, OOPSLA 2005.
You can downloaded from: http://portal.acm.org/citation.cfm?id=1094964&coll=ACM&dl=ACM&CFID=72196433&CFTOKEN=8952623


Releases


Back