From: Fraser <newsfraser@blancolioni.org>
Subject: Re: Safe Units Handling in Ada
Date: Thu, 23 May 2002 12:16:51 +0200
Date: 2002-05-23T10:17:45+00:00 [thread overview]
Message-ID: <3CECC193.3050000@blancolioni.org> (raw)
In-Reply-To: u8z6cjfzp.fsf@gsfc.nasa.gov
Stephen Leake wrote:
> I've done some thinking about how this will integrate with my
> Robotics code, and I'll need Cartesian vectors with units. I
> currently have:
[code snipped]
> Now I'll have to have Meters_Cart_Vector_Type and
> Velocity_Cart_Vector_Type, etc, with associated operations. Time will
> remain a scalar :).
>
> Any thoughts on extending macks to output that?
Someone will have to remind me how the cross product is calculated!
This is just off the top of my head:
unit Meters_Type;
unit Seconds_Type;
unit Velocity_Type is Meters_Type / Seconds_Type;
vector Meters_Cart_Vector_Type is Meters_Type * 3;
vector Velocity_Cart_Vector_Type is Velocity_Type * 3;
There would have to be some sort of syntax for specifying the vector
index type (or to ask for a record type instead). The operators + and -
(binary and unary) would be provided, as well as a cross product if it's
a 3 vector, and a dot product in any case.
Maybe we don't need a vector keyword, since it's implied by the syntax
"identifier operator constant-integer", but on the other hand there's no
need to worry about keyword bloat in a language of this size.
> I like the origin of "macks"; it warms my physics nerd heart :). Be
> sure to put it in the package somewhere.
Thanks! I was pretty tickled when I realised the letters spelled a word
(sort of).
Fraser.
next prev parent reply other threads:[~2002-05-23 10:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-21 10:01 Safe Units Handling in Ada Fraser Wilson
2002-05-21 14:21 ` Pat Rogers
2002-05-21 15:58 ` Stephen Leake
2002-05-22 8:32 ` Fraser
2002-05-22 10:21 ` Fraser
2002-05-22 16:37 ` Stephen Leake
2002-05-23 10:16 ` Fraser [this message]
2002-05-23 16:03 ` Stephen Leake
2002-05-22 22:44 ` William C. Brennan
2002-05-23 8:55 ` Russ
2002-05-23 9:28 ` Fraser
2002-05-23 10:03 ` martin.m.dowie
2002-05-23 10:24 ` Fraser
2002-05-23 11:03 ` martin.m.dowie
2002-05-23 15:57 ` Dan Andreatta
2002-05-23 16:15 ` Fraser Wilson
2002-05-23 16:48 ` martin.m.dowie
2002-05-23 9:04 ` Russ
2002-05-23 10:01 ` Fraser Wilson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox