comp.lang.ada
 help / color / mirror / Atom feed
* Re: Units Checking is Ada - Solicitation of Comments on Standard Proposal
  1997-08-06  0:00 Units Checking is Ada - Solicitation of Comments on Standard Proposal William A Whitaker
@ 1997-08-06  0:00 ` W. Wesley Groleau x4923
  1997-08-07  0:00 ` Mats Weber
  1997-08-08  0:00 ` Anonymous
  2 siblings, 0 replies; 5+ messages in thread
From: W. Wesley Groleau x4923 @ 1997-08-06  0:00 UTC (permalink / raw)



> desired unit.  In a new twist, the conversion functions are defaulted 
> to 1.0, meaning that Meter(1.0) and Meter are equivalent.  

This would prohibit "use SI, SI.Ops;"
(Can't have "Meter" be both a subtype and a function).  Try adding
"use SI;" at the beginning of si_test.adb and see what kind of fun
messages you get.

-- 
----------------------------------------------------------------------
    Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA
Senior Software Engineer - AFATDS                  Tool-smith Wanna-be

Don't send advertisements to this domain unless asked!  All disk space
on fw.hac.com hosts belongs to either Hughes Defense Communications or 
the United States government.  Using email to store YOUR advertising 
on them is trespassing!
----------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Units Checking is Ada - Solicitation of Comments on Standard Proposal
@ 1997-08-06  0:00 William A Whitaker
  1997-08-06  0:00 ` W. Wesley Groleau x4923
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: William A Whitaker @ 1997-08-06  0:00 UTC (permalink / raw)



I am soliciting comments on a standards proposal for units Ada
checking.  Please send comments directly to me at  -  whitaker@erols.com


There has long been discussion of using the properties of Ada for the
checking of physical units in engineering/scientific applications, with
little result.  Most often it is sketched as an example in texts, but
never brought to completion.  A full system was standardized in 1993 as
part of IEEE Std 1226.1, however the units checking portion did not
receive much as there was a non-checking primary option.

For the upgrade of IEEE Std 1226.1 (given the new number of P1446)
changes have been made to make the system more user-friendly.  Along
with more intelligent compilers and some Ada 95 features, this has
encouraged a stronger push for regular use of Ada units checking.

The Ada community is invited to comment on and make suggestions about
the proposal before it goes to ballot.  There is a brief write-up in the
form of a P1446 Issue, but the associated code has been modified to be
stand-alone Ada for this exercise.  Two trivial test programs are
provided (Test_SI and Test_Other_Units).  Please test with your
examples.

Issue:

http://www.erols.com/whitaker/iss_418.htm

Code:

http://www.erols.com/whitaker/si_check.ada

--   There is cuteness in the code such that GNAT earlier than 3.10 has
a problem.  A somewhat modified version is provided for earlier GNAT
(but comments are solicited on the full version):

http://www.erols.com/whitaker/si_gnat.ada

General P1446 Page:

http://www.erols.com/whitaker/p1446.htm


The present proposal is as follows.  There is a package SI which has the
definition of Unit as a discriminant record.  SI.Ops contains the
operations ("*", "/", etc.) as well as the conversion from Real to the
desired unit.  In a new twist, the conversion functions are defaulted to
1.0, meaning that Meter(1.0) and Meter are equivalent.  SI.Ops.Symbols
contains the unit constants for the trick above.  There are other
supporting packages for Unit_Text_IO and Unit_Conversions to/from
Other_Units ("English").  All this is based on IEEE Std 1226.1 (1983).




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Units Checking is Ada - Solicitation of Comments on Standard Proposal
  1997-08-06  0:00 Units Checking is Ada - Solicitation of Comments on Standard Proposal William A Whitaker
  1997-08-06  0:00 ` W. Wesley Groleau x4923
@ 1997-08-07  0:00 ` Mats Weber
  1997-08-08  0:00   ` W. Wesley Groleau x4923
  1997-08-08  0:00 ` Anonymous
  2 siblings, 1 reply; 5+ messages in thread
From: Mats Weber @ 1997-08-07  0:00 UTC (permalink / raw)



I had a quick look at it. I don't like the fact that operations are in the
separate (sub)package SI.Ops, because they are not part of the primitive
profile of the type Unit.

So , if you derive the type, the operations are not derived, and you cannot do
   use type SI.Unit;
to get direct access to the operators.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Units Checking is Ada - Solicitation of Comments on Standard Proposal
  1997-08-06  0:00 Units Checking is Ada - Solicitation of Comments on Standard Proposal William A Whitaker
  1997-08-06  0:00 ` W. Wesley Groleau x4923
  1997-08-07  0:00 ` Mats Weber
@ 1997-08-08  0:00 ` Anonymous
  2 siblings, 0 replies; 5+ messages in thread
From: Anonymous @ 1997-08-08  0:00 UTC (permalink / raw)



On Thu, 07 Aug 1997 15:34:11 +0200, Mats Weber
<Mats.Weber@elca-matrix.ch> wrote:

> I had a quick look at it. I don't like the fact that operations are in the
> separate (sub)package SI.Ops, because they are not part of the primitive
> profile of the type Unit.
> 
> So , if you derive the type, the operations are not derived, and you cannot do
>    use type SI.Unit;
> to get direct access to the operators.
> 
> 

FWIW, this is an Ada-83 trick used by a small but significant group: The
author doesn't want to "use" SI, but wants direct visibility to its
operators; therefore, he puts the operators in a subpackage, and uses
it: "use SI.Ops;".

In Ada, one can achieve the same effect without the subpackage with "use
type".

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"You couldn't catch clap in a brothel, silly English K...niggets."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Units Checking is Ada - Solicitation of Comments on Standard Proposal
  1997-08-07  0:00 ` Mats Weber
@ 1997-08-08  0:00   ` W. Wesley Groleau x4923
  0 siblings, 0 replies; 5+ messages in thread
From: W. Wesley Groleau x4923 @ 1997-08-08  0:00 UTC (permalink / raw)



> I had a quick look at it. I don't like the fact that operations are in the
> separate (sub)package SI.Ops, because they are not part of the primitive
> profile of the type Unit.
> 
> So , if you derive the type, the operations are not derived, and you cannot do
>    use type SI.Unit;
> to get direct access to the operators.

That's an excellent objection.  However, why would you derive these
types?  It's designed to ensure only safe mixing of dimensioned
values.  One might like to derive or subtype in order to limit
ranges, but the design of the package prevents that--another
objection.

-- 
----------------------------------------------------------------------
    Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA
Senior Software Engineer - AFATDS                  Tool-smith Wanna-be

Don't send advertisements to this domain unless asked!  All disk space
on fw.hac.com hosts belongs to either Hughes Defense Communications or 
the United States government.  Using email to store YOUR advertising 
on them is trespassing!
----------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-08-08  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-06  0:00 Units Checking is Ada - Solicitation of Comments on Standard Proposal William A Whitaker
1997-08-06  0:00 ` W. Wesley Groleau x4923
1997-08-07  0:00 ` Mats Weber
1997-08-08  0:00   ` W. Wesley Groleau x4923
1997-08-08  0:00 ` Anonymous

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