comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Mize <smize@link.com>
Subject: Re: The great Java showcase (re: 2nd historic mistake)
Date: 1997/08/29
Date: 1997-08-29T00:00:00+00:00	[thread overview]
Message-ID: <34072CEE.753@link.com> (raw)
In-Reply-To: EFonoz.AFC@ecf.toronto.edu


Patrick Doyle wrote:
> 
> In article <fxrabd1l2c.fsf@boole.enst-bretagne.fr>,
> Laurent Guerby  <Laurent.Guerby@enst-bretagne.fr> wrote:
> >doylep@ecf.toronto.edu (Patrick Doyle) writes:
> >
> >   Ada has the ability to manipulate unconstrained objects (something
> >like returning dynamic sized objects/arrays) without requiring user
> >heap management. The greatly obviates the need for user
> >allocation/deallocation, you can write very large Ada programs without
> >doing fine grained heap management (and I agree with you, very error
> >prone unless you're some kind of programming deity ;-).
> 
>   I'm not sure I follow the Ada approach.  How do these "unconstrained
> objects" work?

Here's a very brief discussion (since this thread is so cross-
posted).  For more info, see the tutorials at www.adahome.com.

An Ada object must be constrained (have a definite size) when it
exists.  However, you can define a type that is not constrained.
Each object of that type gets its constraints when created.  If
a procedure parameter is unconstrained, it gets its constraints
from the value given when the procedure is called.

Here's a concrete example:

declare

  -- Define an integer-indexed array of characters.  We do NOT
  -- define the min or max indexes, or the size of the array.

  type Flex_Array is array (integer range <>) of character;

  A, B: Natural; -- integers greater than or equal to zero

  procedure X (F: in Flex_Array);
begin

  -- get values for A and B somehow
  ...

  declare
    Flex_A: Flex_Array (1..A);
    Flex_B: Flex_Array (3..B);
  begin
    X (Flex_A);
    X (Flex_B);
  end;
end;


Where Flex_A and Flex_B exist, they have well-defined sizes.
However, these sizes are defined at run time.

In the first call to X, F'First (the first array index) will be
1.  In the second call to X, F'First will be 3.  If B is less than
3, Flex_B is a null array, which is perfectly fine in Ada.

Sam Mize




  parent reply	other threads:[~1997-08-29  0:00 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-08-25  0:00 The great Java showcase (re: 2nd historic mistake) Bertrand Meyer
1997-08-26  0:00 ` BruceMount
     [not found]   ` <5u0nil$atg@mulga.cs.mu.OZ.AU>
1997-08-28  0:00     ` not
1997-08-28  0:00     ` Richard A. O'Keefe
     [not found]       ` <5u3o1n$hu5@mulga.cs.mu.OZ.AU>
1997-08-28  0:00         ` Nick Leaton
1997-09-15  0:00       ` Tim Ottinger
1997-09-16  0:00         ` W. Wesley Groleau x4923
1997-08-28  0:00   ` Brett J. Stonier
     [not found]     ` <JSA.97Aug28182029@alexandria.organon.com>
     [not found]       ` <3406C150.3EE5EE0E@stratasys.com>
1997-08-29  0:00         ` Jon S Anthony
1997-08-29  0:00           ` Jay Martin
1997-08-29  0:00             ` Jon S Anthony
1997-09-02  0:00             ` W. Wesley Groleau x4923
1997-09-15  0:00       ` Tim Ottinger
1997-08-26  0:00 ` Flavius.Vespasianus
     [not found] ` <JSA.97Aug26153546@alexandria.organon.com>
     [not found]   ` <34034658.7DE14518@eiffel.com>
1997-08-27  0:00     ` Jon S Anthony
     [not found] ` <3402FD4D.C196785B@brightwood.com>
1997-08-27  0:00   ` Patrick Doyle
1997-08-28  0:00   ` Paul Johnson
1997-08-28  0:00     ` Brett J. Stonier
1997-08-28  0:00     ` Jeff Brown
1997-08-28  0:00     ` Robert Dewar
1997-08-29  0:00       ` Paul Johnson
1997-08-27  0:00 ` James P. White
1997-08-27  0:00   ` Robert Dewar
     [not found]   ` <34047A7D.62319AC4@eiffel.com>
1997-08-27  0:00     ` Bertrand Meyer
1997-08-27  0:00       ` Matthew S. Whiting
1997-08-28  0:00         ` Flavius.Vespasianus
1997-08-28  0:00       ` Mike Coffin
1997-08-29  0:00         ` Robert Dewar
1997-08-30  0:00           ` James P. White
1997-08-31  0:00           ` Jon S Anthony
1997-08-28  0:00       ` James P. White
1997-08-29  0:00       ` Dennis Weldy
1997-09-03  0:00         ` Charles Ditzel
     [not found]   ` <01bcb38a$8ddc1200$1c10d30a@ntwneil>
1997-08-28  0:00     ` Robert Dewar
1997-08-28  0:00       ` James P. White
     [not found]         ` <EFnKuI.4rI@ecf.toronto.edu>
1997-08-29  0:00           ` Memory management techniques -- was Re: The great Java showcase Jon S Anthony
1997-08-30  0:00         ` The great Java showcase (re: 2nd historic mistake) Bert Bril
1997-08-31  0:00           ` Jay Martin
1997-08-29  0:00       ` Lee Webber
1997-08-29  0:00       ` Mike Charlton
     [not found]         ` <N.19970829.uput@sisyphus.demon.co.uk>
1997-09-02  0:00           ` Mike Charlton
1997-09-03  0:00             ` Dave Sparks
     [not found]       ` <EFn8CI.D9p@ecf.toronto.edu>
1997-08-29  0:00         ` Peter Hermann
1997-08-29  0:00         ` Robert Dewar
1997-08-30  0:00           ` Patrick Doyle
1997-08-31  0:00           ` Jon S Anthony
1997-09-01  0:00             ` Robert Dewar
1997-09-02  0:00               ` Jon S Anthony
1997-09-05  0:00                 ` Robert Dewar
1997-09-06  0:00                   ` Jon S Anthony
1997-08-29  0:00         ` Laurent Guerby
     [not found]           ` <EFonoz.AFC@ecf.toronto.edu>
1997-08-29  0:00             ` Samuel Mize [this message]
1997-08-29  0:00         ` Arthur Nelson
1997-08-29  0:00           ` Patrick Doyle
1997-09-01  0:00             ` Robert Dewar
1997-08-28  0:00     ` James P. White
1997-08-28  0:00     ` Robert Dewar
1997-08-29  0:00       ` Lee Webber
     [not found] <5tvvsj$lh2$1@news2.digex.net>
1997-08-27  0:00 ` Jeff Brown
1997-08-28  0:00   ` Patrick Doyle
1997-08-28  0:00     ` Robert Dewar
1997-08-27  0:00 ` W. Wesley Groleau x4923
1997-08-27  0:00   ` W. Wesley Groleau x4923
1997-08-28  0:00 ` Brett J. Stonier
1997-08-28  0:00   ` Jon S Anthony
1997-08-29  0:00     ` James P. White
1997-08-29  0:00   ` Paul Johnson
1997-08-29  0:00     ` Brett J. Stonier
1997-08-29  0:00     ` Dennis Weldy
     [not found]     ` <5u6ovi$5kb$1@news2.digex.net>
1997-09-01  0:00       ` Paul Johnson
  -- strict thread matches above, loose matches on Subject: below --
1997-08-29  0:00 Ell
1997-08-29  0:00 ` Robert Dewar
1997-08-29  0:00   ` Jay Martin
1997-08-30  0:00   ` Joachim Durchholz
1997-08-30  0:00   ` Patrick Doyle
1997-08-30  0:00     ` Jay Martin
1997-09-01  0:00   ` Paul Johnson
1997-09-01  0:00     ` Robert Dewar
1997-09-02  0:00       ` Matthew S. Whiting
1997-09-03  0:00         ` Robert Munck
1997-09-05  0:00         ` Robert Dewar
1997-09-02  0:00       ` Martin Tom Brown
1997-09-02  0:00       ` Jeff Kotula
1997-09-02  0:00       ` Veli-Pekka Nousiainen
1997-09-08  0:00       ` Richard A. O'Keefe
1997-09-13  0:00         ` Mark S. Hathaway
1997-09-16  0:00           ` Des  Kenny
1997-10-28  0:00           ` John English
1997-09-16  0:00         ` Des  Kenny
1997-09-16  0:00           ` Robert Dewar
1997-09-05  0:00     ` Darren New
1997-09-02  0:00   ` W. Wesley Groleau x4923
1997-09-05  0:00     ` Robert Dewar
1997-09-15  0:00   ` Tim Ottinger
1997-09-16  0:00     ` Joachim Durchholz
1997-09-18  0:00       ` Robert Dewar
1997-09-16  0:00     ` Robert Dewar
1997-08-29  0:00 ` Brett J. Stonier
1997-08-29  0:00 ` Jon S Anthony
1997-08-29  0:00 Ell
1997-08-30  0:00 BruceMount
1997-09-04  0:00 Marin David Condic, 561.796.8997, M/S 731-96
     [not found] <97090916235363@psavax.pwfl.com>
1997-09-11  0:00 ` Robert Dewar
1997-09-15  0:00 Ell
1997-09-16  0:00 ` Tim Ottinger
1997-09-17  0:00 ` Doc
1997-09-17  0:00 Ell
1997-09-17  0:00 Ell
1997-09-16  0:00 ` Mark Wilden
1997-09-17  0:00 ` Joachim Durchholz
1997-09-17  0:00 ` Robert B. Love 
1997-09-17  0:00 Ell
replies disabled

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