comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Concatenation and Characters
Date: Thu, 24 Oct 2002 10:13:14 -0400
Date: 2002-10-24T10:13:14-04:00	[thread overview]
Message-ID: <urfvvr79undm3a@corp.supernews.com> (raw)
In-Reply-To: uhefc429n.fsf@FWILSON.i-did-not-set--mail-host-address--so-shoot-me


"Fraser Wilson" <newsfraser@blancolioni.org> wrote in message
news:uhefc429n.fsf@FWILSON.i-did-not-set--mail-host-address--so-shoot-me...
> "Frank J. Lhota" <NOSPAM.lhota.adarose@verizon.net> writes:
>
> > Consider this:
> >
> >     type Great_One is ( Jackie_Gleason );
> >
> >     type S is array( Great_One range <> ) of Honeymooner;
> >
> > What would S'Empty'First and S'Empty'Last return?
>
> It's certainly (imho) a bit of a wart that you need at least two
> elements in the A'Range'Base to make a zero-length array.  And it's
> not clear that 'First and 'Last should be defined at all when 'Range
> is empty, although it's certainly convenient sometimes.

The issue is that an enumeration type is "its own base type."  The problem
is in the declaration of Great_One, which really should have been done like
this:

type Great_One_Base is
   (Great_One_Base_First, Jackie_Gleason, Great_One_Base_Last);

subtype Great_One is Great_One_Base range
   Great_One_Base'Succ (Great_One_Base_First) ..
   Great_One_Base'Pred (Great_One_Base_Last);

type S is array (Great_One range <>) of Honeymooner.

Now all the problems go away.

Yes, this is sort of a pain, but it's simply a consequence of Ada's type
model for enumerations.  For integer discrete types, the language gives you
T'Base for free, but for enumerations you have to declare T'Base manually.

 You have the same issue when instantiating the Charles vector package,
which accepts a discrete type as a generic formal index type.  The web page
has an explanation similar to what appears above.

http://home.earthlink.net/~matthewjheaney/charles/charles-vectors-unbounded.
html

The most recent release occured on 2002/10/21.

http://home.earthlink.net/~matthewjheaney/charles/index.html








  reply	other threads:[~2002-10-24 14:13 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-10 14:50 Concatenation and Characters Justin Birtwell
2002-10-10 14:55 ` Preben Randhol
2002-10-10 15:04   ` Justin Birtwell
2002-10-10 15:22     ` Preben Randhol
2002-10-10 15:30       ` Justin Birtwell
2002-10-10 16:05         ` Georg Bauhaus
2002-10-10 16:07         ` Preben Randhol
2002-10-10 17:45         ` Robert A Duff
2002-10-10 15:32       ` Justin Birtwell
2002-10-10 15:36         ` Preben Randhol
2002-10-10 16:44         ` Mark Biggar
2002-10-10 17:45           ` Stephen Leake
2002-10-10 21:53             ` Mark Biggar
2002-10-18 17:03           ` Programmer Dude
2002-10-18 18:13             ` Preben Randhol
2002-10-18 18:36             ` Wes Groleau
2002-10-21 15:16               ` Georg Bauhaus
2002-10-18 21:33             ` Mark Biggar
2002-10-20  2:01               ` Dmitry A.Kazakov
2002-10-21 14:13                 ` Wes Groleau
2002-10-21 15:22                   ` Dmitry A. Kazakov
2002-10-21 19:38                     ` Georg Bauhaus
2002-10-22 22:15                       ` Dmitry A.Kazakov
2002-10-22 12:05                         ` Georg Bauhaus
2002-10-22 12:19                           ` Lutz Donnerhacke
2002-10-22 14:43                             ` Georg Bauhaus
2002-10-23  8:39                           ` Dmitry A. Kazakov
2002-10-23 14:39                             ` Georg Bauhaus
2002-10-24  8:18                               ` Dmitry A. Kazakov
2002-10-21 16:50                   ` Warren W. Gay VE3WWG
2002-10-21 15:20             ` Georg Bauhaus
2002-10-21 17:51               ` Programmer Dude
2002-10-21 18:48                 ` Jim Rogers
2002-10-21 19:44                   ` tmoran
2002-10-21 20:42                   ` Programmer Dude
2002-10-22  1:42                     ` Jeffrey Carter
2002-10-22 14:37                       ` Robert A Duff
2002-10-22 18:51                         ` Jeffrey Carter
2002-10-23  7:01                         ` Pascal Obry
2002-10-22 14:45                       ` Matthew Heaney
2002-10-22 18:47                         ` Jeffrey Carter
2002-10-22 21:31                         ` Robert A Duff
     [not found]                         ` <3DB59D75.20609 <wccd6q29n3l.fsf@shell01.TheWorld.com>
2002-10-23  2:02                           ` Jeffrey Carter
2002-10-23 13:16                             ` Matthew Heaney
2002-10-23 19:11                               ` Jeffrey Carter
2002-10-23 15:24                             ` Robert A Duff
2002-10-23 19:24                               ` Jeffrey Carter
2002-10-24  0:33                                 ` Robert A Duff
2002-10-22  3:46                     ` Jim Rogers
2002-10-22 14:48                       ` Robert A Duff
2002-10-22 15:02                         ` Fraser Wilson
2002-10-22 15:38                           ` David C. Hoos
2002-10-22 15:44                             ` Fraser Wilson
2002-10-22 16:13                         ` Robert A Duff
2002-10-23  8:58                           ` Dmitry A. Kazakov
2002-10-23  9:08                             ` Lutz Donnerhacke
2002-10-23  9:34                               ` Dmitry A. Kazakov
2002-10-23 10:10                                 ` Lutz Donnerhacke
2002-10-23 17:15                                 ` Frank J. Lhota
2002-10-24  8:41                                   ` Dmitry A. Kazakov
2002-10-24  9:25                                   ` Fraser Wilson
2002-10-24 14:13                                     ` Matthew Heaney [this message]
     [not found]                         ` <un <wcc7kgazc20.fsf@shell01.TheWorld.com>
2002-10-22 16:46                           ` David C. Hoos
2002-10-22  8:51                   ` Stuart Palin
2002-10-22 18:56                     ` Programmer Dude
2002-10-21 19:42                 ` Georg Bauhaus
  -- strict thread matches above, loose matches on Subject: below --
2002-10-11  5:04 Grein, Christoph
2002-10-11 10:30 ` Preben Randhol
2002-10-23  5:15 Grein, Christoph
2002-10-23 13:19 ` Matthew Heaney
2002-10-24  5:53 Grein, Christoph
2002-10-24 14:04 ` Matthew Heaney
replies disabled

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