comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Ada.strings.bounded problems?
Date: Tue, 24 Jan 1995 18:49:47 GMT
Date: 1995-01-24T18:49:47+00:00	[thread overview]
Message-ID: <D2xAyz.6L2@world.std.com> (raw)
In-Reply-To: Mats.Weber-2301951656460001@mlma11.matrix.ch

In article <Mats.Weber-2301951656460001@mlma11.matrix.ch>,
Mats Weber <Mats.Weber@matrix.ch> wrote:
>I can't believe that the `Goodenough trick' is used as an excuse for not
>repairing the rules on "=". If there had been an AI on this trick, then it
>would certainly have been forbidden by some additional rule, as was
>clearly the intent in the design of the language.

I think the first time I saw that trick, it was *in* an AI, which
confirmed that you can define "=" using the trick (but not the
straightforward way).  I don't have the AI number -- I'm too lazy to
look it up.

I completely agree that the non-composability of "=" was a bad idea in
Ada 83.  However, fixing it for Ada 95 would not have been so easy.

For one thing, you have to think about all the other operators.  Suppose
I redefine "<" on character type.  Should that compose properly, so that
"<" on an array-of-that-character type uses the redefined "<"?  Of
course, you want that, but this is a more serious upward
incompatibility.  You don't have to use any Goodenough Tricks to define
that "<" -- it's a perfectly reasonable thing to do.  Changing the
run-time behavior of perhaps many existing programs would have been
rather disruptive.

But if you don't fix "<", then why fix "="?  It would seem strange for
"=" on the array to call the redefined "=" on the characters, but "<"
does not call the redefined "<".

Another issue is how far to go in the composability.  For example, if I
redefine "=" on a discrete type, does it affect the way case statements
work?  After all case statements compare the value of an expression for
equality with the various when's.  But what would the full coverage
rules mean if "=" does something weird, like always returning True?

Similarly, the expression X.all checks that X /= null.  Should it use
the programmer's notion of "/=" there?  Probably not.  Constraint checks
on discriminated types check for equality of the discriminants.

We sidestepped all those issues by drawing the line in a different place
-- "=" composes properly for tagged types, and not for untagged types.
Arrays of tagged types don't automatically have "<", and you can't do
case statements on them, and so on.  In fact, "=" and "/=" are the
*only* predefined operators for tagged types, so it's not so
unreasonable to treat them specially.

- Bob



  reply	other threads:[~1995-01-24 18:49 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 [this message]
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
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