Units?

Stephen Pair spair at acm.org
Sat Aug 10 12:48:16 UTC 2002


This is a rather nice package!...in fact, it's so nice that I think it
should be considered for inclusion in the base image.  There are a few
rough edges, but they are minor.

One of these is the fact that you must use the #units: message (i.e. "2
units: #seconds").  I'd like to simply write "2 seconds"...I think it
would be nice to add a lot of the common units as messages on Number.

It is so much nicer to write:

  someObject doSomethingEvery: 5 seconds.

Than:

  someObject doSomethingEverySeconds: 5

Or worse:

  someObject doSomethingEvery: 5  "with no indication of the units"

I would think that this would also be nice for Etoys.  For example, one
could say "anEtoy moveForward: 5 meters"...and you could introduce
scaling factors in the playfields.  I could even imagine directly
supporting complex units in the messages so you could write something
like:

  Playfield newSize: 20 square meters.  "Then of course scale it down to
fit on screen"

Or in 3-D space:

  Playfield newSize: 20 cubic meters.

You could even directly support:  "20 miles per hour"

This framework provides all of the underlying code to do the
conversions, unit derivations, arithmetic, adding new units...dressing
it up to allow these additional message formations would be simple.

- Stephen

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Brian T Rice
> Sent: Thursday, August 08, 2002 2:51 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: Units?
> 
> 
> http://home.netsurf.de/helge.horch/squeak/units.html
> 
> I've ported it to my multi-method Self dialect. It's rather nice.
> 
> On Thu, 8 Aug 2002, Stephen Pair wrote:
> 
> > Has anyone implements units in Squeak?  I'm most intersted 
> in units of 
> > time...for example, I'd like to be able to write things like:
> >
> >   (Delay for: 250 milliseconds) wait.
> >   (Delay for: 20 seconds) wait.
> >   (Delay for: 30 years) wait.
> >
> > - Stephen
> >
> >
> 
> 
> 




More information about the Squeak-dev mailing list