comp.lang.ada
 help / color / mirror / Atom feed
From: stt@henning.camb.inmet.com (Tucker Taft)
Subject: Re: Ada.strings.bounded problems?
Date: Tue, 24 Jan 1995 19:24:18 GMT
Date: 1995-01-24T19:24:18+00:00	[thread overview]
Message-ID: <D2xCKJ.DMD@inmet.camb.inmet.com> (raw)
In-Reply-To: 1995Jan23.135503@lglsun.epfl.ch

In article <1995Jan23.135503@lglsun.epfl.ch>,
Robb Nebbe <nebbe@lglsun.epfl.ch> wrote:
>... Clearly the semantics as they are defined, which allow the
>reemergence of predefined equality, are not desirable ...

Actually, the Ada 9X design team proposed in 1991 or thereabouts
that predefined operators would never "reemerge" in generics or 
composite operations.  However, at least at the time, there were
those who defended the Ada 83 behavior as *desirable*, mostly
based on examples where a generic which presumed predefined
semantics for an operator could become quite confused
if the operators did not satisfy various presumed invariants.
For example, one might presume that X < Y implied not X >= Y.
However, one could imagine an overriding of the predefined operators
such that there were "incomparable" values, and both X < Y and 
X >= Y would return False.  

At the time, the example that was mentioned several 
times was an overriding of user-defined operators 
to create modular arithmetic.  It was easy to
construct generics which could get pretty confused because
they presumed normal non-modular invariants such as
A > 0 implies A + B > B.  Text_IO.Integer_IO was one
possible example of this.

Although we (the design team) argued for no reemergence at 
the time, we ultimately reached the conclusion that, for 
untagged types, predefined operators should continue 
to reemerge, as they did in Ada 83.  I suppose
upward compatibility was the strongest argument, though the
argument about desirability and simplicity of semantics for
generics was considered as well.

Fully general support for user-defined "=" came somewhat later
during the Ada 9X design process, but in any case the goal
was to treat "=" *more* like other operators, rather than *less*.

Having decided to retain predefined operator reemergence for
scalar types, we were reluctant to make a special case for the
equality operator on untagged record types.  The same thing
applied to untagged derived types.  

Basically, we decided that tagged types would be used for
"fully" abstract types, since only on such types could you
handle levels of indirection, etc., where a user-defined
equality was clearly important.  

In other words, we decided to keep uniformity across all
untagged types, and across all tagged types, but sacrifice 
some uniformity between tagged and untagged types.

The general "philosophical" difference between tagged types
and untagged types is that untagged types are simpler and
leaner and better for relatively "concrete" types, whereas
tagged types are a bit more expensive but more flexible and
better for more "abstract" types.  

For derived types, untagged derived types are presumed 
to be types that are essentially identical internally, 
but with a strong type distinction created between them to help 
support compile-time checking of one sort or another (such
as two integer types where one counts apples and the other oranges).  

Tagged derived types (i.e.  type extensions), on the other hand, 
are potentially completely different internally from their parent
type, and it is intentionally possible to *avoid* strong 
compile-time type distinctions between them by using a class-wide type,
which makes sense when the differences are merely implementation
differences, rather than significant interface differences.

Or in short, untagged derived types can be used to create arbitrary
interface differences on top of identical implementations, whereas
tagged type extensions can be used to preserve a common interface
across significantly different implementations.

>Maybe the cost of not providing consistant semantics between tagged
>and untagged record types will exceed the cost of introducing an
>upward incompatability, maybe not.   ...

There was also the issue of consistency between untagged record
types and untagged non-record types.  As mentioned above, we chose
to make the "break" between tagged and untagged.  One could instead
have made the break between records and non-records, but we felt
that was not as natural a breaking point, particularly since in Ada 83,
one could implement a given private type with a record or a non-record
without any signicant effect on the clients.

> ... It is a really tough call right
>now. Especially since there really isn't any data, just speculation,
>to base the decision on.

It is always painful to break consistency.  Clearly the issue
of reemergence of predefined operators will continue to reemerge
over time ;-).

>Robb Nebbe

-Tucker Taft  stt@inmet.com
Ada 9X Mapping/Revision Team
Intermetrics, Inc.



  parent reply	other threads:[~1995-01-24 19:24 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <TARJEIJ.95Jan11183331@ulrik.uio.no>
1995-01-12 14:24 ` Ada.strings.bounded problems? Robert Dewar
1995-01-12 15:59 ` Norman H. Cohen
1995-01-13 19:33   ` Mats Weber
     [not found] ` <EACHUS.95Jan11170317@spectre.mitre.org>
1995-01-12 18:10   ` Robert Dewar
     [not found] ` <D29L78.J9@nntpa.cb.att.com>
1995-01-12 18:16   ` Norman H. Cohen
1995-01-13 10:52     ` Tarjei Jensen
1995-01-13 19:29     ` Mats Weber
     [not found]       ` <3fduto$ta7@watnews1.watson.ibm.com>
     [not found]         ` <Mats.Weber-1701951908250001@mlma11.matrix.ch>
1995-01-18 14:27           ` Norman H. Cohen
1995-01-19 16:49             ` Mats Weber
1995-01-21  5:28               ` Robert Dewar
     [not found]             ` <1995Jan19.124412@lglsun.epfl.ch>
1995-01-19 21:59               ` Norman H. Cohen
1995-01-23 15:56                 ` Mats Weber
1995-01-24 18:49                   ` Robert A Duff
1995-01-24 19:24                   ` Robert Dewar
1995-01-25 17:26                     ` Norman H. Cohen
     [not found]                     ` <Mats.Weber-2701952307410001@mlma11.matrix.ch>
1995-01-30 14:15                       ` David Emery
1995-02-01 14:02                         ` William Brennan
1995-02-01 14:28                           ` William Brennan
1995-02-01 20:46                           ` Robert Firth
     [not found]                             ` <3gr5b4$1eq2@info4.rus.uni-stuttgart.de>
     [not found]                               ` <D3H6qD.AD6@inmet.camb.inmet.com>
1995-02-07 20:22                                 ` Norman H. Cohen
1995-02-11 15:58                                   ` David Weller
1995-02-01 21:48                           ` Mark A Biggar
     [not found]                           ` <3grvi1$jvm@gnat.cs.nyu.edu>
1995-02-08 15:22                             ` Passive tasks (was: bounded strings) Schilling J.
1995-02-10  1:51                               ` Robert Dewar
1995-01-20 17:00               ` Ada.strings.bounded problems? Robert Dewar
1995-01-18 16:23           ` Cyrille Comar
1995-01-18 17:48           ` Robert Dewar
1995-01-19  1:36           ` Keith Thompson
1995-01-19 17:53             ` Jacob Sparre Andersen
1995-01-20 11:12               ` Robb Nebbe
1995-01-20 16:03                 ` Magnus Kempe
1995-01-21 18:57                   ` Robert Dewar
1995-01-23 13:37                     ` Robb Nebbe
1995-01-24 14:38                       ` Robert Dewar
1995-01-24 19:24                       ` Tucker Taft [this message]
1995-01-25 10:25                         ` Robb Nebbe
     [not found]                         ` <Mats.Weber-2701952308000001@mlma11.matrix.ch>
1995-01-29  5:29                           ` Robert Dewar
     [not found]           ` <1995Jan18.164836.2222@nbivax.nbi.dk>
1995-01-22 18:05             ` Tucker Taft
1995-01-12 22:17   ` Robert Dewar
     [not found]     ` <D2D8DC.JvM@nntpa.cb.att.com>
     [not found]       ` <3fja22$fab@source.asset.com>
1995-01-18 18:02         ` Norman H. Cohen
1995-01-20  5:12         ` Robert Dewar
     [not found]   ` <D2J8H0.DMu@aplcenmp.apl.jhu.edu>
1995-01-18  5:01     ` Robert Dewar
1995-01-22 18:09     ` Tucker Taft
replies disabled

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