comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Question for the folks who designed Ada95
Date: 1999/04/29
Date: 1999-04-29T00:00:00+00:00	[thread overview]
Message-ID: <wccg15joaxc.fsf@world.std.com> (raw)
In-Reply-To: yeczp3s9vf3.fsf@king.cts.com

Keith Thompson <kst@cts.com> writes:

> That's fine if the size of the shift is a constant, but as someone
> else has pointed out, it's more difficult if it's a variable.  I
> suppose a compiler could optimize
>     
>     X := X * 2**N;
> 
> to a shift instruction, but I'd hate to have to depend on it.

I suppose in this variable case it's not so trivial as to be universally
available, but it's still a feasible optimization (assuming the "2**"
is sitting there for the compiler to see).

One of our recently-validated compilers was in use for several months
(and of course passed all of the validation tests) before we discovered
a bug in our exponentiation run-time routine.  Apparently, the vast
majority of cases encountered in practise (and in the ACVC) where "**"
is used are static expressions, and so were correctly calculated at
compile time.  This implies that if the above optimization isn't done,
it's not commonly useful.  Which also implies that variable-length shift
operators are not commonly useful.

> > It's not clear what shifting should mean if the modulus is not a power
> > of 2.  Robert has stated many times that that should never have been
> > allowed, and I tend to agree.
> 
> Do you mean that shifting should not be allowed for such types, or
> that the types themselves should not be allowed?

I meant that Robert strongly believes that the language should not allow
non-power-of-two modular types.  And I (weakly) agree.  Actually, I have
a lot of complaints about the modular type feature.

Note that this feature was completely redesigned several times during
the Ada 9X design.  Sometimes I think the one we ended up with wasn't
particularly *better* than the others, it just happened to be the one
that was sitting there in the proposed standard document around the time
when we were starting to freeze things (no more large technical
changes).

> If non-power-of-two modular types are really worth having in the
> language, it might have been nice to make them a distinct class of
> type, like decimal fixed-point vs. ordinary fixed-point.  That would
> allow providing shifts as attributes without running into generic
> contract model problems.  I think.

At the expense of extra syntax and rules...

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




  reply	other threads:[~1999-04-29  0:00 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-26  0:00 Question for the folks who designed Ada95 Corey Ashford
1999-04-27  0:00 ` Robert Dewar
1999-04-27  0:00   ` Corey Ashford
1999-04-27  0:00   ` Tarjei Tj�stheim Jensen
1999-04-27  0:00     ` David Starner
1999-04-27  0:00       ` Robert Dewar
1999-04-27  0:00         ` David Starner
1999-04-28  0:00           ` Robert Dewar
1999-04-28  0:00           ` Samuel Mize
1999-04-28  0:00         ` Tarjei Tj�stheim Jensen
1999-04-28  0:00           ` Robert Dewar
1999-04-28  0:00             ` Robert A Duff
1999-04-29  0:00             ` Bill Ghrist
1999-04-29  0:00             ` Tarjei Tj�stheim Jensen
1999-04-28  0:00           ` dennison
1999-04-28  0:00             ` Robert Dewar
1999-04-28  0:00               ` Robert A Duff
1999-04-28  0:00                 ` Brian Hanson
1999-04-28  0:00                   ` bill
1999-04-29  0:00                     ` Robert S. White
1999-04-29  0:00                       ` Robert Dewar
1999-04-30  0:00                         ` Robert S. White
1999-04-30  0:00                           ` dennison
1999-04-29  0:00                       ` Robert Dewar
1999-04-30  0:00                         ` Robert S. White
1999-04-29  0:00                     ` Robert Dewar
1999-04-28  0:00                       ` Pat Rogers
1999-04-29  0:00                         ` Robert Dewar
1999-04-29  0:00                           ` dennison
1999-04-29  0:00                             ` Pat Rogers
1999-04-30  0:00                 ` Robert Dewar
1999-04-28  0:00           ` Larry Kilgallen
1999-04-28  0:00           ` Robert A Duff
1999-04-29  0:00           ` Question for the folks who designed Ad David Kristola
1999-04-29  0:00             ` Paul Duquennoy
1999-04-27  0:00     ` Question for the folks who designed Ada95 bill
1999-04-27  0:00       ` Robert Dewar
1999-04-27  0:00         ` Al Christians
1999-04-27  0:00           ` Larry Kilgallen
1999-04-27  0:00             ` Al Christians
1999-04-28  0:00         ` Robert A Duff
1999-04-28  0:00           ` Robert Dewar
1999-04-29  0:00             ` Matthew Heaney
1999-04-29  0:00               ` Robert Dewar
1999-04-29  0:00               ` Jean-Pierre Rosen
1999-04-27  0:00       ` dennison
1999-04-27  0:00         ` Robert Dewar
1999-04-29  0:00           ` Robert A Duff
1999-04-27  0:00     ` Robert Dewar
1999-04-28  0:00       ` Corey Ashford
1999-04-28  0:00         ` Robert Dewar
1999-04-28  0:00           ` Robert A Duff
1999-04-28  0:00             ` Robert Dewar
1999-04-29  0:00               ` Robert A Duff
1999-04-29  0:00           ` Corey Ashford
1999-04-29  0:00             ` Robert Dewar
1999-04-29  0:00               ` Geert Bosch
1999-04-29  0:00               ` Fraser Wilson
1999-04-29  0:00                 ` Marin David Condic
1999-04-29  0:00                 ` Tucker Taft
1999-04-29  0:00                 ` Mark A Biggar
1999-04-30  0:00                   ` Tucker Taft
1999-04-30  0:00                 ` David Brown
1999-04-29  0:00             ` Corey Ashford
1999-04-27  0:00     ` Larry Kilgallen
1999-04-29  0:00     ` Aidan Skinner
1999-04-30  0:00       ` Matthew Heaney
1999-04-27  0:00 ` Samuel Mize
1999-04-27  0:00   ` Samuel Mize
1999-04-27  0:00     ` Robert Dewar
1999-04-28  0:00       ` Corey Ashford
1999-04-28  0:00         ` Robert Dewar
1999-04-29  0:00           ` Corey Ashford
1999-04-29  0:00             ` Robert Dewar
1999-04-29  0:00               ` Fraser Wilson
1999-04-29  0:00                 ` Robert Dewar
1999-04-29  0:00                 ` Marin David Condic
1999-04-28  0:00       ` Samuel Mize
1999-04-28  0:00         ` Samuel Mize
1999-04-28  0:00     ` Corey Ashford
1999-04-28  0:00     ` Corey Ashford
1999-04-27  0:00 ` Matthew Heaney
1999-04-27  0:00   ` Corey Ashford
1999-04-28  0:00     ` Marin David Condic
1999-04-28  0:00     ` Robert A Duff
1999-04-28  0:00       ` Keith Thompson
1999-04-29  0:00         ` Robert A Duff [this message]
1999-04-27  0:00   ` Matthew Heaney
replies disabled

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