From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Safe Units Handling in Ada
Date: 23 May 2002 12:03:41 -0400
Date: 2002-05-23T16:10:42+00:00 [thread overview]
Message-ID: <uhekyonqa.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3CECC193.3050000@blancolioni.org
Fraser <newsfraser@blancolioni.org> writes:
> Someone will have to remind me how the cross product is calculated!
I've got a generic vector package that does everything I need. It's in
SAL at
http://users.erols.com/leakstan/Stephe/Ada/Sal_Packages/index.htm,
file sal-gen_math-gen_vector.ads.
It's instantiated in files sal-gen_math-gen_dof_3.ads and
sal-gen_math-gen_dof_6.ads.
That's what I need adapted to units.
> 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;
>
This looks promising. I think it should be in a second input file, and
produce a second package; some parts of the system need vectors, some
don't.
> There would have to be some sort of syntax for specifying the vector
> index type (or to ask for a record type instead).
Yes; I use an enumeration type for some vectors, integers for others.
> 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.
And lots more in my package.
> 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.
Yes, make it easy to parse, and easy to generate friendly error
messages.
--
-- Stephe
next prev parent reply other threads:[~2002-05-23 16:03 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
2002-05-23 16:03 ` Stephen Leake [this message]
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