units

lex at cc.gatech.edu lex at cc.gatech.edu
Tue Nov 10 23:05:56 UTC 1998


Craig Latta <Craig.Latta at NetJam.ORG> wrote:
> 
> > > > 5 kilogram meters per second squared
> >
> > Actually, in context, squared associates just with the
> > immeadiately leftmost unit.
> 
> 	Sure, and the thing answered by (5 kilogram meters per second) knows this also.
> 
> > As for #per, I think you are underestimating the amount of funkiness 
> > required to pull this off given Smalltalk semantics.
> 
> 	Not at all. >>per could answer an instance of a new class called "CompositeUnit" or somesuch, which performs dimensional analysis algebra. It could have a "numerator" of (5 kilogram meters), and a "denominator" which is set by the ensuing >>second. I think it's quite doable.
> 


True, it's doable.  However, it would be really nice if the underlying semantics were simple, too, as opposed to merely *looking* simple.  If you were reading the code for this, it would look really odd!

One of the cool things about Squeak is that you can relatively easily dig down to any depth in the system you want.  To be practical, this requires that every level be intuitive, not just the level that "end users" see.

Okay, here are two specific proposals.  First, instead of a generic #per, have #perSecond, #perMinute, etc.  Second, just use #/ and go home :).  These would look like, respectively:

	9.8 meters perSecond perSecond
	9.8 meters / (1 second squared)

of course "squared" is still funny....  "2 seconds squared" would be different than "2 seconds seconds" under either of these proposals.


Lex





More information about the Squeak-dev mailing list