comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Math on dimensioned quantities
Date: 1996/07/10
Date: 1996-07-10T00:00:00+00:00	[thread overview]
Message-ID: <DuB08H.2HI@world.std.com> (raw)
In-Reply-To: 9607091345.AA03915@most


In article <9607091345.AA03915@most>,
W. Wesley Groleau (Wes) <wwgrol@PSESERV3.FW.HAC.COM> wrote:
>writers listening?--how about a pragma similar to
>
>   pragma Disallow ( Operation => "*", For_Type => Inch );

How about:

    function "*"(X, Y: Inches) return Inches is <>;

?  Then this particular "*" is abstract and therefore can't be called,
and this is checked at compile time.  You can still multiply
inches*inches to get square-inches.  It's annoying that you might have
to declare lots of "is <>" functions, but I think it does solve the
problem.

Make sure this is declared in the same package as type Inches; otherwise
all kinds of weirdness can happen.

- Bob




  parent reply	other threads:[~1996-07-10  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-09  0:00 Math on dimensioned quantities W. Wesley Groleau (Wes)
1996-07-09  0:00 ` progers
1996-07-10  0:00 ` Robert A Duff [this message]
1996-07-10  0:00   ` progers
1996-07-10  0:00   ` Jon S Anthony
1996-07-10  0:00     ` Robert A Duff
1996-07-10  0:00       ` Robert Dewar
1996-07-11  0:00         ` Dale Stanbrough
replies disabled

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