comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Array Of Constant Strings?
Date: 22 Feb 2003 14:31:36 -0500
Date: 2003-02-22T14:31:36-05:00	[thread overview]
Message-ID: <wcclm08159j.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 3E4D46B9.6060805@acm.org

Jeffrey Carter <jrcarter@acm.org> writes:

> Name_List : constant array (1 .. 26) of Name_String :=
>     (+"Anthony",
>      +"Barbara",
>      +"Claudia",
>      ... and so on.
> 
> I don't like this, though. One of Ada's explicit design goals is to
> emphasize ease of reading over ease of writing, and "To_Bounded_String"
> is clearer than "+" to the reader. This is the opposite of C's
> philosophy, in which ease of writing is everything and ease of reading
> is unimportant.

I don't agree.  I think putting To_Bounded_String all over the place
makes the code *less* readable.  Bounded_String is, conceptually, a
string type (even though the RM doesn't say so), so string literals
ought to be allowed for it.

Using varying-length strings should be just as painless as using
Standard.String; literals, array indexing, etc, should be allowed
without cluttering the code with explicit conversion operations that
don't really do anything interesting.

> If all the strings are always the same length, then using fixed length
> strings is even simpler. However, I would tend to be suspicious of such
> a requirement; things like that are almost always changed later.

Well, we don't know why the OP wants same-length strings, but I agree --
such a restriction seems suspicious.

- Bob



  parent reply	other threads:[~2003-02-22 19:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-14  2:58 Array Of Constant Strings? Dr Nancy's Sweetie
2003-02-14  4:28 ` tmoran
2003-02-14  7:28 ` Dale Stanbrough
2003-02-14  7:47   ` tmoran
2003-02-14 10:06     ` Dale Stanbrough
     [not found] ` <19guh-2f4.ln1@beastie.ix.netcom.com>
2003-02-14 19:41   ` Jeffrey Carter
2003-02-14 20:38     ` tmoran
     [not found]     ` <e0q0i-n14.ln1@beastie.ix.netcom.com>
2003-02-15 22:28       ` Jeffrey Carter
2003-02-22 19:31     ` Robert A Duff [this message]
2003-04-14 18:43       ` Dr Nancy's Sweetie
2003-04-15 11:36         ` Georg Bauhaus
2003-04-15 13:40           ` Dr Nancy's Sweetie
2003-04-15 15:13             ` Georg Bauhaus
2003-04-16  2:17               ` Matthew Heaney
2003-04-16 16:35                 ` Chad R. Meiners
2003-04-16 21:03                 ` Georg Bauhaus
2003-04-17 17:53                   ` Robert A Duff
2003-04-17 20:34                     ` Georg Bauhaus
replies disabled

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