comp.lang.ada
 help / color / mirror / Atom feed
From: cwarack@cs.usafa.af.mil (Chris Warack <sys mgr>)
Subject: Re: next "big" language?? (disagree)
Date: 1996/06/11
Date: 1996-06-11T00:00:00+00:00	[thread overview]
Message-ID: <4pki88$gpq@usafa2.usafa.af.mil> (raw)
In-Reply-To: 4pj7e0$fat@goanna.cs.rmit.EDU.AU


In article <4pj7e0$fat@goanna.cs.rmit.EDU.AU>, rav@goanna.cs.rmit.EDU.AU (++           robin) writes:
|> 	Richard Riehle <rriehle@nunic.nu.edu> from San Diego writes:
|> 
|> 	>> Robin, from Australia raplied.
|> 	>>
|> 	>> "---Why, someone inevitably decides that the range is going
|> 	>> to be something different!  Users are apt to change their minds.
|> 	>> Then someone has to go in and modify the program.  Or, someone
|> 	>> overlooked a limit, and put in a limit one smaller than that
|> 	>> actually required.  Again, someone has to go in and find where
|> 	>> that limit is, and change it."
|> 
|> 	>  Good point.  This is one of the very reasons why Ada works so well
|> 	>  for this kind of thing, when programs are written correctly.  In
|> 	>  particular, when one takes advantage of the availability of
|> 	>  attributes. Let's say that we establish a range of 1 through 10 for some
|> 	>  type T1. Then we write a program using variables of that type.
|> 
|> 	>  For example, we define the type T1, and an unconstrained array as follows:
|> 
|> 	>     type T1 is range 1..10;
|> 	>     type Vector is array(Positive range <>) of Float;
|> 
|> 	>  Then we declare a variable of type Vector:
|> 
|> 	>     Float_Set : Vector(T1'First..T1'Last);
|> 
|> 	>  Some algorithm, elsewhere in the code can be written as:
|> 
|> 	>      for I in Float_Set'Range loop ... end loop;
|> 
    ...
|> 
|> ---One of the problems of using rigid facilities -- amply
|> illustrates my point.  Arrays don't often have fixed sizes.
|> The size depends on the problem.  One day, it might be 10,
|> next day, 300, day after, 90.
|> 
|>    Are you seriusly suggesting that EACH time the program
|> is run that it be edited and recompiled?  And what
|> happens -- as is often the case -- the size of the array
|> changes DURING the run?

No.  If that's the case change the declaration of T1 to:

  subtype T1 is positive range 1 .. What_ever_the_value_is_today; *

or

  subtype T1 is positive range 1 .. This_runs_size;

or

  type Vector is private;
    if you really want to make it behave in some special manner.

or ...

* Recognizing that T1 really needed to be a subtype in the example
  above

In those first two examples, it doesn't matter how the upper values
are set (e.g., hardware, sensor, data file, user input ...) and this
works fine.  It's not too hard to change from the rigid approach to 
this more flexible approach either.  It does preclude some possibilities
for static optimizations perhaps.

The last alternative is a serious change to the given example.  When
you don't want to use an array, however, you shouldn't use an array then.
Define the dynamic data structure of your dreams in whatever way you see fit.

-- 
Christopher A. Warack, Capt, USAF  cwarack@cs.usafa.af.mil (719) 472-2401
Computer Science Department, US Air Force Academy
This content in no way reflects the opinions, standards, or policy
of the USAF Academy, or the US government.




  parent reply	other threads:[~1996-06-11  0:00 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4p0fdd$4ml@news.atlantic.net>
1996-06-04  0:00 ` next "big" language?? (disagree) Peter Hermann
1996-06-04  0:00   ` The Amorphous Mass
1996-06-04  0:00     ` Peter Hermann
1996-06-04  0:00       ` The Amorphous Mass
1996-06-05  0:00         ` Michael David WINIKOFF
1996-06-07  0:00           ` Robert Dewar
1996-06-04  0:00     ` Robert Dewar
1996-06-06  0:00       ` Ken Garlington
1996-06-12  0:00       ` Help making ada pretty CSC Trusted Systems Group
1996-06-14  0:00         ` Sandy McPherson
1996-06-19  0:00         ` Ruediger Berlich
1996-06-05  0:00     ` next "big" language?? (disagree) Ian Ward
1996-06-05  0:00       ` The Amorphous Mass
1996-06-08  0:00         ` Robert Dewar
1996-06-08  0:00           ` The Amorphous Mass
1996-06-09  0:00             ` Robert Dewar
1996-06-08  0:00         ` Robert Dewar
1996-06-05  0:00   ` ++           robin
1996-06-05  0:00     ` Ian Ward
1996-06-05  0:00       ` Ian Ward
1996-06-06  0:00         ` Richard Riehle
1996-06-07  0:00           ` Richard Riehle
1996-06-08  0:00             ` O'Connor
1996-06-07  0:00           ` Robert Dewar
1996-06-10  0:00             ` Richard Riehle
1996-06-11  0:00           ` ++           robin
1996-06-11  0:00             ` David Weller
1996-06-11  0:00             ` Chris Warack <sys mgr> [this message]
1996-06-11  0:00             ` James_Rogers
1996-06-11  0:00               ` Kevin J. Weise
1996-06-11  0:00         ` ++           robin
1996-06-11  0:00           ` Ian Ward
1996-06-12  0:00             ` ++           robin
1996-06-12  0:00               ` Ian Ward
1996-06-11  0:00       ` Jon S Anthony
     [not found]   ` <4p60nk$imd@euas20.eua.ericsson.se>
     [not found]     ` <4p8lmq$oq7@goanna.cs.rmit.edu.au>
1996-06-11  0:00       ` ++           robin
1996-06-11  0:00         ` A. Grant
1996-06-12  0:00           ` Robert Dewar
1996-06-17  0:00             ` A. Grant
1996-06-18  0:00               ` Robert Dewar
1996-06-24  0:00                 ` Robert I. Eachus
1996-06-26  0:00                   ` Norman H. Cohen
1996-06-19  0:00             ` Jon S Anthony
1996-06-20  0:00               ` Robert Dewar
1996-06-24  0:00                 ` Adam Beneschan
1996-06-24  0:00                 ` Keith Thompson
1996-06-25  0:00                   ` Simon Read
1996-06-25  0:00                   ` Robert A Duff
1996-06-24  0:00                 ` Dale Stanbrough
1996-06-24  0:00                   ` hopkinc
1996-06-24  0:00                   ` Lars Duening
1996-06-24  0:00                   ` Assertions (was: Re: next "big" language?? (disagree)) Robert A Duff
1996-06-24  0:00                     ` Robert Dewar
1996-06-25  0:00                       ` Robert A Duff
1996-06-28  0:00                         ` Robert Dewar
1996-06-24  0:00                     ` Assertions (a different intent?) Gary McKee
     [not found]                     ` <4qrljg$15l8@watnews1.watson.ibm.com>
1996-06-28  0:00                       ` Assertions (was: Re: next "big" language?? (disagree)) Robert Dewar
1996-06-24  0:00                   ` next "big" language?? (disagree) Robert Dewar
1996-06-24  0:00                   ` Adam Beneschan
1996-06-26  0:00                   ` Marc C. Brooks
1996-06-26  0:00                   ` Marc C. Brooks
     [not found]                   ` <4qsbm7$r1s@Starbase.NeoSoft.COM>
1996-06-28  0:00                     ` "Assert"? "Assume"? (was: next "big" language?? (disagree)) Alexander Bunkenburg
1996-06-28  0:00                       ` Ian Collier
1996-07-01  0:00                     ` Cameron Laird
1996-06-25  0:00                 ` next "big" language?? (disagree) Brian Nettleton @pulsar
1996-06-26  0:00                   ` Robert Dewar
1996-06-28  0:00                     ` Fergus Henderson
1996-06-28  0:00                       ` Robert Dewar
1996-06-30  0:00                         ` Fergus Henderson
1996-06-30  0:00                           ` Robert Dewar
1996-06-25  0:00                 ` Darin Johnson
1996-06-26  0:00                   ` A. Grant
1996-06-26  0:00                   ` Dale Stanbrough
1996-06-12  0:00           ` ++           robin
1996-06-12  0:00             ` A. Grant
1996-06-14  0:00               ` Richard A. O'Keefe
1996-06-12  0:00         ` Richard A. O'Keefe
1996-06-12  0:00           ` ++           robin
1996-06-12  0:00             ` Richard A. O'Keefe
1996-06-13  0:00               ` ++           robin
1996-06-13  0:00               ` ++           robin
1996-06-12  0:00   ` Jon S Anthony
1996-06-14  0:00   ` Jon S Anthony
1996-06-15  0:00   ` Jon S Anthony
1996-06-18  0:00     ` Adam Beneschan
1996-06-18  0:00   ` Jon S Anthony
1996-06-28  0:00     ` Assertions (an heretic view) Michel Gauthier
1996-06-28  0:00       ` Robert Dewar
1996-06-28  0:00       ` Robert A Duff
1996-06-06  0:00 ` next "big" language?? (disagree) Dale Pontius
1996-06-11  0:00 ` Jon S Anthony
1996-06-12  0:00 ` Help making ada pretty Pedro de las Heras
1996-06-18  0:00 ` next "big" language?? (disagree) ++           robin
1996-06-07  0:00 Ian Ward
1996-06-08  0:00 ` O'Connor
1996-06-10  0:00   ` Matt Kennel
1996-06-11  0:00     ` Ian Ward
1996-06-12  0:00       ` Norman H. Cohen
1996-06-11  0:00     ` Robb Nebbe
1996-06-09  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