units

Ken Dickey kend at apple.com
Wed Nov 11 18:06:01 UTC 1998


>> OK, so when one of these funky non-mathematical objects gets passed to some
>> code that sends it the message #squared (intending on squaring), how do we 
>> guess the right squared semantics, because you proposal will give the 
>> wrong answer.
>
>	Perhaps it's the wrong message at that point. In common practice natural 
>language, one would need to delimit, e.g., "5 kilogram meters per second, 
>squared". The delimiter is the comma before "squared". (In common practice 
>technical notation, one would use parentheses and a superscript.)  So 
>perhaps sending >>, tells the Unit to "group" (the equivalent of the 
>parentheses in technical notation). Then a succeeding >>squared squares 
>the whole thing, as intended.

[I have not been following this, so take the following "cum grano salis"]

Numerical operations such should only operate on the numeric part of the 
object.

I would punt on "squared" but use "kilogram meters per second second" in 
the units part of the object.  I.e. I suggest working out the 
<value,unit> model/abstraction first and optimizing the unit syntax later.

$0.02
-KenD





More information about the Squeak-dev mailing list