Units of Measure

Darryl psygnisfive at yahoo.com
Fri Oct 26 12:48:44 PDT 2007

I think it'd be interesting and useful to have some
way to have units of measure as part of the structure
of a number. For instance

1) var area = 5m * 5m; // area == 25m*m or whatever

You could register a new unit of measure by relating
it to other units of measure:

2) newUnit( "x", 1.523m ); // 1x == 1.523m
3) newUnit( "sq_m", m*m ); // 1sq_m == 1m*m, (2m)*(2m)
== 4m*m == 4sq_m, ...
4) newUnit( "W", J/s );

and then convert back and for using standard type

5) area = area to x; // area == 57.988225x
6) var time = 500J/20W; // time = 25s

The system would treat units like constants, in most
situations, but allow them in certain contexts that
variables aren't allowed (such as immediately
preceeding or following a number, as above). It would
also treat the variable as containing "something"
thats numberlike, so they could be multiplied against
one another and still retain their unit-behavior.

It's just an idea but I think it'd be incredibly
useful in the future for designing advanced web applications.


Be seeing you...

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the Es4-discuss mailing list