comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nickroberts@callnetuk.com>
Subject: Re: Ragged Array Proposal
Date: 1999/09/24
Date: 1999-09-24T00:00:00+00:00	[thread overview]
Message-ID: <37ebb11e@eeyore.callnetuk.com> (raw)
In-Reply-To: t7k8ph19um.fsf@calumny.jyacc.com

Hyman Rosen <hymie@prolifics.com> wrote in message
news:t7k8ph19um.fsf@calumny.jyacc.com...
[...]
| Is it possible to do something similar in Ada?
| Something like (forgive my fractured pseudo-Ada syntax) -
|
| apple:  aliased String(5) := "apple";
| orange: aliased String(6) := "orange";
| pear:   aliased String(4) := "pear";
|
| type StringPtr is access String(<>);
|
| fruits: StringPtr[1..3] := (apple'access, orange'access, pear'access);

This is one of the unappealing alternatives I was talking about.

In Ada 95, one would have to write something like:

Fruit_001: constant aliased String := "Apple";
Fruit_002: constant aliased String := "Orange";
Fruit_003: constant aliased String := "Pear";
...

type String_Sight is access constant String;

Fruits: constant array (Positive range <>) of String_Sight :=
    (Fruit_001'Access, Fruit_002'Access, Fruit_003'Access, ...);

Whereas with ragged arrays, one need only write:

Fruits: constant array (Positive range <>) of String :=
    ("Apple", "Orange", "Pear", ...);

Much simpler and clearer, don't you think?

-------------------------------------
Nick Roberts
http://www.callnetuk.com/home/nickroberts
http://www.adapower.com/lab/adaos
-------------------------------------








  reply	other threads:[~1999-09-24  0:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <37e7c08e@eeyore.callnetuk.com>
1999-09-22  0:00 ` Ragged Array Proposal Ted Dennison
1999-09-22  0:00   ` Ray Blaak
1999-09-23  0:00     ` Tucker Taft
1999-09-23  0:00       ` Nick Roberts
1999-09-23  0:00         ` Hyman Rosen
1999-09-24  0:00           ` Nick Roberts [this message]
1999-09-24  0:00             ` Hyman Rosen
1999-09-25  0:00               ` Robert Dewar
1999-09-27  0:00                 ` Hyman Rosen
1999-09-27  0:00                   ` Brian Rogoff
1999-09-28  0:00                   ` Robert Dewar
1999-09-24  0:00         ` Robert Dewar
1999-09-24  0:00           ` Wes Groleau
1999-09-25  0:00             ` Robert Dewar
1999-09-25  0:00             ` Robert Dewar
1999-09-24  0:00         ` Ted Dennison
1999-09-24  0:00           ` Nick Roberts
1999-09-24  0:00       ` Robert Dewar
1999-09-23  0:00     ` Ted Dennison
1999-09-24  0:00     ` Robert Dewar
1999-09-23  0:00 ` Robert I. Eachus
1999-09-24  0:00   ` Nick Roberts
1999-09-25  0:00     ` Robert Dewar
1999-09-25  0:00     ` Robert Dewar
1999-09-25  0:00     ` Robert Dewar
1999-09-27  0:00     ` Ted Dennison
1999-09-27  0:00       ` Pascal Obry
1999-09-28  0:00         ` Ted Dennison
1999-09-28  0:00           ` Robert Dewar
1999-09-29  0:00             ` Geoff Bull
1999-09-28  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