comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Language Design Mistakes (was "not intended...")
Date: 1997/05/13
Date: 1997-05-13T00:00:00+00:00	[thread overview]
Message-ID: <EA4Mn3.EKE@world.std.com> (raw)
In-Reply-To: dewar.863496826@merv


In article <dewar.863496826@merv>, Robert Dewar <dewar@merv.cs.nyu.edu> wrote:
>Wes said
>
><<If there is no conceivable reason for ever passing the value of an
>array to a subprogram or entry, or assigning to or from the array
>or a slice of it, then it will always be the only array of its type,
>so a superfluous type declaration is merely clutter _hindering_
>source readability.  (Some say the type name can be chosen for
>documentation value, but I don't see why that can't all go into
>the object name.)>>

This is true, but if the language is going to allow this for arrays and
tasks, it should allow it for all types.  That would make the language
simpler, by making it more uniform.  It might even be useful, once in a
while:

    Recursion_Count: range 0..100 := 0; -- "range 0..100" declares an
                                        -- anonymous integer type.
                                        -- This isn't Ada.
    
    function F(...) return ... is
    begin
        Recursion_Count := Recursion_Count + 1; -- Blow up if runaway recursion
        ... F(...) ...
        Recursion_Count := Recursion_Count - 1;
    end F;

This is better than having a named type, for the reasons stated by Wes,
above.  And it's better than using an existing type, such as Integer,
because it clearly expresses the fact that Recursion_Count isn't being
freely mixed with any other integer variables, which is a useful fact
when understanding the program.

Note that protected types (originally called protected *records*) can be
anonymous, making them uniform with tasks, but not with records.

>OK, but just make sure you know the rules. If you think this way, it is
>all too easy to expect this to extend to a protected object that protects
>an array, this is a very common syntactic error. Or that it extends to
>a single field of a record that appears only once.

There was some push for Ada 9X to allow anonymous arrays for record
components and the like, for uniformity, but it adds complexity, and so
we decided it wasn't worth it.  Where does that anon array type get
implicitly declared?  Certainly not just before the component_decl
(which would be analogous to the object_decl case), because that would
result in nested types, which cause semantic trouble.  Certainly not
just before the record type decl, because then you couldn't make the
bounds depend on discriminants, which would be an unexpected
non-uniformity.  Maybe the array type gets implicitly declared before
the record, and its first subtype before the component?

- Bob




  reply	other threads:[~1997-05-13  0:00 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-23  0:00 Not intended for use in medical, Robert C. Leif, Ph.D.
1997-04-24  0:00 ` J. Florio
1997-04-25  0:00 ` Ken Garlington
1997-04-25  0:00 ` Kevin Cline
1997-04-25  0:00   ` Robert Dewar
1997-04-28  0:00 ` John Apa
1997-04-28  0:00   ` Robert Dewar
1997-04-29  0:00     ` Kaz Kylheku
1997-04-30  0:00       ` John Apa
     [not found]       ` <3367CE1E.5ED1@die_spammer.dasd.honeywell.com>
1997-05-01  0:00         ` Kaz Kylheku
1997-05-03  0:00       ` Simon Wright
1997-05-04  0:00         ` Richard Kenner
1997-05-04  0:00         ` Robert Dewar
1997-05-04  0:00         ` Kaz Kylheku
1997-05-04  0:00           ` Robert Dewar
1997-05-04  0:00             ` Richard Kenner
1997-05-05  0:00             ` Kaz Kylheku
1997-05-06  0:00               ` Kaz Kylheku
1997-05-06  0:00                 ` Robert A Duff
1997-05-07  0:00                   ` Robert Dewar
1997-05-08  0:00                     ` Kaz Kylheku
1997-05-08  0:00                       ` Robert Dewar
1997-05-09  0:00                         ` Kaz Kylheku
1997-05-12  0:00                       ` W. Wesley Groleau (Wes)
1997-05-12  0:00                         ` John G. Volan
1997-05-14  0:00                       ` Nick Roberts
1997-05-14  0:00                         ` Robert Dewar
1997-05-14  0:00                           ` Jeff Carter
     [not found]                             ` <dewar.863632434@merv>
1997-05-15  0:00                               ` Kaz Kylheku
1997-05-18  0:00                                 ` Robert Dewar
1997-05-15  0:00                         ` Kaz Kylheku
1997-05-08  0:00                     ` Robert A Duff
1997-05-09  0:00                       ` Robert I. Eachus
1997-05-11  0:00                         ` Robert Dewar
1997-05-11  0:00                           ` Matthew Heaney
1997-05-12  0:00                             ` Robert Dewar
1997-05-12  0:00                               ` Matthew Heaney
1997-05-13  0:00                                 ` Jon S Anthony
1997-05-13  0:00                                   ` Matthew Heaney
1997-05-14  0:00                                     ` Robert Dewar
1997-05-14  0:00                                     ` Robert Dewar
1997-05-14  0:00                                 ` Robert Dewar
1997-05-15  0:00                                   ` W. Wesley Groleau (Wes)
1997-05-14  0:00                                 ` Nick Roberts
1997-05-14  0:00                                 ` Robert Dewar
1997-05-12  0:00                           ` Robert I. Eachus
1997-05-13  0:00                             ` Robert Dewar
1997-05-14  0:00                               ` Nick Roberts
1997-05-14  0:00                                 ` Robert Dewar
     [not found]                                   ` <01bc6182$30e3a7c0$LocalHost@xhv46.dial.pipex.com>
1997-05-16  0:00                                     ` Robert Dewar
1997-05-16  0:00                                     ` Robert A Duff
1997-05-16  0:00                                       ` Robert I. Eachus
1997-05-18  0:00                                         ` Nick Roberts
1997-05-18  0:00                                           ` Matthew Heaney
1997-05-19  0:00                                             ` Robert A Duff
1997-05-19  0:00                                             ` Robert I. Eachus
1997-05-19  0:00                                               ` Matthew Heaney
1997-05-20  0:00                                                 ` Nick Roberts
1997-05-20  0:00                                                   ` Matthew Heaney
1997-05-21  0:00                                                     ` Dale Stanbrough
1997-05-08  0:00                     ` John G. Volan
1997-05-10  0:00                       ` Robert Dewar
1997-05-10  0:00                         ` John G. Volan
1997-05-11  0:00                           ` Robert Dewar
1997-05-11  0:00                             ` John G. Volan
1997-05-11  0:00                               ` Robert A Duff
1997-05-12  0:00                                 ` Robert Dewar
1997-05-12  0:00                                 ` John G. Volan
1997-05-11  0:00                             ` John G. Volan
1997-05-11  0:00                               ` Robert Dewar
1997-05-12  0:00                             ` John G. Volan
1997-05-12  0:00                             ` John G. Volan
1997-05-12  0:00                               ` Robert Dewar
1997-05-17  0:00                               ` Robert I. Eachus
     [not found]                                 ` <dewar.863877808@merv>
1997-05-17  0:00                                   ` Robert Dewar
1997-05-17  0:00                                     ` Jon S Anthony
1997-05-21  0:00                                       ` Syntax for tagged record types (was Re: Not intended for use in medical,) Ben Brosgol
1997-05-20  0:00                                         ` Matthew Heaney
1997-05-21  0:00                                           ` Syntax for tagged record types and class types Mats Weber
1997-05-21  0:00                                             ` Matthew Heaney
1997-05-22  0:00                                               ` Mats Weber
1997-05-27  0:00                                               ` Tucker Taft
1997-05-30  0:00                                                 ` Mats.Weber
1997-05-22  0:00                                             ` Samuel A. Mize
1997-05-22  0:00                                               ` Samuel A. Mize
1997-05-23  0:00                                               ` Mats Weber
1997-05-21  0:00                                           ` Syntax for tagged record types (was Re: Not intended for use in medical,) Jon S Anthony
1997-05-21  0:00                                             ` Matthew Heaney
1997-05-22  0:00                                               ` Robert I. Eachus
1997-05-25  0:00                                                 ` Matthew Heaney
1997-05-28  0:00                                                   ` Robert I. Eachus
1997-05-23  0:00                                               ` Jon S Anthony
1997-05-23  0:00                                                 ` Simon Wright
1997-05-23  0:00                                                 ` Matthew Heaney
1997-05-25  0:00                                                   ` Jon S Anthony
1997-05-28  0:00                                                   ` Syntax for tagged record types (was Re David Kristola
     [not found]                                         ` <mheaney-ya023680002005972314260001@news.ni.net <mheaney-ya023680002105972302430001@news.ni.net>
1997-05-22  0:00                                           ` Syntax for tagged record types (was Re: Not intended for use in medical,) Robert A Duff
1997-05-22  0:00                                             ` John G. Volan
1997-05-23  0:00                                               ` Jon S Anthony
1997-05-23  0:00                                               ` Matthew Heaney
1997-05-23  0:00                                                 ` Jon S Anthony
1997-05-23  0:00                                                   ` John G. Volan
1997-05-24  0:00                                                     ` Robert A Duff
1997-05-24  0:00                                                       ` Matthew Heaney
1997-05-28  0:00                                                         ` Robert I. Eachus
1997-05-25  0:00                                                     ` Jon S Anthony
1997-05-23  0:00                                                   ` Matthew Heaney
1997-05-25  0:00                                                     ` Jon S Anthony
1997-05-25  0:00                                                     ` Robert Dewar
1997-05-27  0:00                                                     ` Ray Blaak
1997-05-12  0:00                         ` Language Design Mistakes (was "not intended...") W. Wesley Groleau (Wes)
1997-05-13  0:00                           ` Robert Dewar
1997-05-13  0:00                             ` Robert A Duff [this message]
1997-05-14  0:00                               ` Robert Dewar
1997-05-13  0:00                             ` W. Wesley Groleau (Wes)
1997-05-07  0:00                   ` Not intended for use in medical, Kaz Kylheku
1997-05-08  0:00                     ` Robert A Duff
1997-04-28  0:00   ` John M. Mills
1997-04-30  0:00     ` Larry Kilgallen
1997-05-02  0:00       ` Nick Roberts
  -- strict thread matches above, loose matches on Subject: below --
1997-05-14  0:00 Language Design Mistakes (was "not intended...") John Herro
1997-05-14  0:00 ` David Emery
     [not found] ` <dewar.863630601@merv>
1997-05-15  0:00   ` W. Wesley Groleau (Wes)
1997-05-16  0:00     ` Mark Hertel
1997-05-22  0:00     ` hamilt2d
1997-05-22  0:00       ` Samuel A. Mize
1997-05-15  0:00   ` John Herro
1997-05-15  0:00     ` Jeff Carter
1997-05-15  0:00       ` John Herro
1997-05-16  0:00 John Walker
     [not found] <199705151433.OAA18453@sw-eng.falls-church.va.us>
1997-05-16  0:00 ` Robert A Duff
1997-05-16  0:00   ` Robert Dewar
1997-05-19  0:00     ` Robert I. Eachus
1997-05-22  0:00   ` Juanma Barranquero
1997-05-16  0:00 ` Robert Dewar
replies disabled

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