units

Michael S. Klein mklein at alumni.caltech.edu
Tue Nov 10 20:53:38 UTC 1998


> > > > 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.

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.  If all you are interested is in improved readability, why not:


	#(5 kilogram meters per second) asUnits

		or

	'5 kilogram meters per second' asUnits

Although it is easy to have messages like

	someDictionary keysCollect: someBlock

do the same as

	someDictionary keys collect: someBlock

I wouldn't want to go through the contortions you suggest to write
something like:

	things asOrderedCollection

by writing:

	things as Ordered Collection

-- MIke

Although I obviously don't mind considering them.

What *should* (Class new new) do?





More information about the Squeak-dev mailing list