comp.lang.ada
 help / color / mirror / Atom feed
From: Charles Hixson <charleshixsn@earthlink.net>
Subject: Operators -> unit analysis
Date: 2000/01/05
Date: 2000-01-05T00:00:00+00:00	[thread overview]
Message-ID: <387383D0.4EA02E95@earthlink.net> (raw)
In-Reply-To: 84thof$9r3$1@nntp4.atl.mindspring.net

Terry Sikes wrote:

> ...
> One thing I'd like to see in both languages is the ability to use a
> set of non-reserved Unicode symbols for operator overloading, to
> disambiguate with the normal operator symbols.
>
> Terry
> --
> tsikes@netcom.com

I don't insist on unicode, but I would also like more operators that could
be overloaded.  How about swiping a leaf from Fortran60 (.le., .eq., ...)
and allowing symbols beginning with a (e.g.) period, then a string of chars
between succ (" ") and char (126) and then another period, with white space
separations  required on each side, to be an overloadable operator?

And some good way to handle units.  So that we could safely say things like:

     speed := 37.miles / 1.5.hours;
I'm not too pleased with the syntax, but the idea is there.  Computer
languages should make unit analysis easy!  This is one of the "promises" of
abstract data types, but I don't feel that it's been truly fulfilled,
largely because it's too difficult to use.  Syntax is part of the problem,
and standard libraries are another part (or perhaps that one's been solved,
and I just don't know).  But standard types should be defined for all the
standard metric units, and most of the more common English units, with
conversion functions between them.  I guess that the standard example
package, Rational, is a good example of how it could be done, but there is
lots of detail work, and it needs to be standardized.

If there is a work group on this, I would like to know about it.  The recent
Mars probe again brought this to my attention.  They may not have been using
Ada (I didn't bother to check), but avoiding this kind of problem is
something that Ada should be for.

I dislike the syntax:
    speed := (37 * mile) / (1.5 * hour);
though I prefer it to:
    speed := miles (37) / hours (1.5);
but that's the best that I know how to do it in Ada.  Is there a better
choice?  (I.e. one that would look more like what a math student would write
in a word problem?)

Of course one could say:
    dist    :    constant Miles    :=    37;
    time   :    constant Hours    :=   1.5;
    speed :  MpH;
    speed    :=    dist / time;

but that seems quite unnecessarily verbose!







  reply	other threads:[~2000-01-05  0:00 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-23  0:00 Ada Brijesh
1999-12-23  0:00 ` Ada reason67
1999-12-23  0:00   ` Ada Robert Dewar
2000-01-03  0:00     ` Ada Terry Sikes
2000-01-03  0:00       ` Ada Hyman Rosen
2000-01-04  0:00         ` Ada Terry Sikes
2000-01-05  0:00           ` Charles Hixson [this message]
2000-01-05  0:00             ` Operators -> unit analysis Hyman Rosen
2000-01-05  0:00               ` Matthew Heaney
2000-01-05  0:00             ` Pat Rogers
2000-01-05  0:00               ` Charles Hixson
2000-01-05  0:00             ` Ted Dennison
2000-01-06  0:00               ` Charles Hixson
2000-01-06  0:00               ` Samuel T. Harris
2000-01-07  0:00                 ` Robert Dewar
2000-01-07  0:00                   ` Robert A Duff
2000-01-07  0:00                     ` Matthew Heaney
2000-01-08  0:00                       ` Robert Dewar
2000-01-08  0:00                         ` Robert A Duff
2000-01-10  0:00                       ` Operator precedence--was " Howard W. LUDWIG
2000-01-14  0:00                         ` Mark A Biggar
2000-01-07  0:00                   ` Ted Dennison
2000-01-07  0:00                     ` Brian Rogoff
2000-01-05  0:00             ` Matthew Heaney
2000-01-05  0:00               ` Charles Hixson
2000-01-06  0:00             ` Robert Dewar
2000-01-06  0:00               ` Terry Sikes
2000-01-06  0:00                 ` Robert A Duff
2000-01-07  0:00                   ` Terry Sikes
2000-01-07  0:00                     ` Brian Rogoff
2000-01-07  0:00                 ` Ted Dennison
2000-01-07  0:00                   ` Tucker Taft
2000-01-08  0:00                     ` Robert Dewar
2000-01-10  0:00                       ` Tucker Taft
2000-01-10  0:00                         ` Florian Weimer
2000-01-04  0:00         ` Ada Richard D Riehle
2000-01-04  0:00           ` Ada Hyman Rosen
2000-01-04  0:00             ` Ada Robert A Duff
2000-01-04  0:00             ` Ada Richard D Riehle
2000-01-04  0:00         ` Ada Florian Weimer
2000-01-04  0:00           ` Ada Brian Rogoff
2000-01-04  0:00           ` Ada Hyman Rosen
2000-01-04  0:00         ` Ada Robert Dewar
2000-01-04  0:00           ` Ada Robert A Duff
2000-01-04  0:00             ` Ada Hyman Rosen
2000-01-04  0:00           ` Ada Hyman Rosen
2000-01-04  0:00       ` Ada Robert Dewar
2000-01-04  0:00         ` Ada Terry Sikes
2000-01-05  0:00           ` Ada Robert Dewar
2000-01-05  0:00             ` Ada Terry Sikes
2000-01-06  0:00           ` Ada Al Christians
2000-01-06  0:00             ` Ada Terry Sikes
2000-01-07  0:00             ` Ada Robert Dewar
1999-12-23  0:00 ` Ada Jon Jensen
1999-12-23  0:00 ` Ada Robert Dewar
1999-12-23  0:00   ` Ada tmoran
1999-12-23  0:00 ` Ada Roger Racine
1999-12-28  0:00   ` Ada Marin D. Condic
1999-12-31  0:00     ` Ada Richard D Riehle
2000-01-02  0:00       ` Ada Marin D. Condic
2000-01-02  0:00         ` Ada Robert Dewar
2000-01-02  0:00           ` Ada Marin D. Condic
2000-01-03  0:00             ` Ada Robert Dewar
2000-01-03  0:00               ` Ada Marin D. Condic
2000-01-03  0:00                 ` Ada Roger Racine
2000-01-03  0:00                 ` Ada Larry Kilgallen
2000-01-04  0:00                   ` Ada Charles Hixson
2000-01-03  0:00             ` Ada Ted Dennison
2000-01-13  0:00     ` Ada Magnus Alexandersson
2000-01-13  0:00     ` Ada Magnus Alexandersson
2000-01-14  0:00       ` Ada Tarjei T. Jensen
2000-01-14  0:00         ` Ada Larry Kilgallen
2000-01-14  0:00           ` Ada Marin D. Condic
2000-01-14  0:00             ` Ada Magnus Alexandersson
2000-01-14  0:00               ` Ada Marin D. Condic
1999-12-23  0:00 ` Ada Greg Martin
  -- strict thread matches above, loose matches on Subject: below --
2000-01-08  0:00 Operators -> Unit Analysis mfeldman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox