comp.lang.ada
 help / color / mirror / Atom feed
From: Charles Hixson <charleshixsn@earthlink.net>
Subject: Re: C vs. Ada - strings
Date: 2000/05/03
Date: 2000-05-03T00:00:00+00:00	[thread overview]
Message-ID: <39105211.4808CA35@earthlink.net> (raw)
In-Reply-To: 8eons4$sqj4@ftp.kvaerner.com

"Tarjei T. Jensen" wrote:

> ...
>
> Whether strings suck is a matter of how easy it is to work with them, not the
> number of fancy operations you can perform on them.

    ...
True within limits.  Range slices are very nice.  But so would be dynamic
resizing!  And the ability to compare different varieties.
It seems to me, that in the context of Ada it would make sense to have two kinds
of string defined initially:
Type 1, fixed would be a range of characters (<> for the range).  This would be
able to compare all subtypes.  Of course, it wouldn't allow resizing.
Type 2, Unbounded strings.  This would allow dynamic resizing, assignment, and
comparisons and assignment from the first type.
All other (system library defined) strings would be defined as subtypes of these
two.  I suppose that one could argue that there should be another two of type
wide_character...But I really want there to be only two types of string, so
instead I would want to go back and redefine the base type of the character that
the string was built on to be the ancestor of Character and Wide_Character.

A problem exists here, in that Character uses half the storage space of
Wide_Character.  I don't think that subtyping would be a good way to proceed, but
I don't want to loose the type conformance.  It's reasonably easy to define
comparison mappings between Character and Wide_Character, and even assignment
mappings aren't impossible, though one does end up with a many-to-one mapping.
But the word length requirements just don't mesh.

Now it's pretty obvious how one could define the strings if one didn't worry
about the character width issue, but how should they be defined to allow for
this?

(Just in case:  No, I'm not enrolled in a class.  This is not an assignment.  I'm
just trying to figure out how to design things in Ada [which, to me, equates to
Ada95].)





  reply	other threads:[~2000-05-03  0:00 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-02  0:00 C vs. Ada - strings Wes Groleau
2000-05-02  0:00 ` Robert A Duff
2000-05-03  0:00   ` Tarjei T. Jensen
2000-05-03  0:00     ` Charles Hixson [this message]
2000-05-04  0:00     ` Robert Dewar
2000-05-04  0:00       ` Charles Hixson
2000-05-06  0:00       ` Tarjei Tj�stheim Jensen
2000-05-03  0:00   ` Wes Groleau
2000-05-03  0:00     ` Tarjei Tj�stheim Jensen
2000-05-03  0:00       ` Ted Dennison
2000-05-04  0:00   ` Robert Dewar
2000-05-04  0:00     ` Hyman Rosen
2000-05-04  0:00       ` Jon S Anthony
2000-05-04  0:00       ` Robert Dewar
2000-05-04  0:00     ` Robert A Duff
2000-05-04  0:00       ` Robert Dewar
2000-05-05  0:00         ` Florian Weimer
2000-05-05  0:00           ` Pascal Obry
2000-05-05  0:00             ` Hyman Rosen
2000-05-06  0:00           ` Tarjei Tj�stheim Jensen
2000-05-06  0:00             ` Florian Weimer
2000-05-07  0:00               ` Robert Dewar
2000-05-09  0:00                 ` Florian Weimer
2000-05-02  0:00 ` Ted Dennison
2000-05-03  0:00   ` Pascal Obry
2000-05-03  0:00     ` Keith Thompson
2000-05-04  0:00       ` Wes Groleau
2000-05-18  0:00       ` Pete
2000-05-18  0:00         ` dale
2000-05-18  0:00           ` Robert A Duff
2000-05-19  0:00             ` dale
2000-05-21  0:00             ` Robert Dewar
2000-05-22  0:00               ` Robert A Duff
2000-05-22  0:00                 ` Keith Thompson
2000-05-24  0:00                 ` 'img Peter Hermann
2000-05-24  0:00                   ` 'img Robert Dewar
2000-05-24  0:00                     ` 'img Ted Dennison
2000-05-25  0:00                       ` 'img Robert Dewar
2000-05-25  0:00                       ` 'img Peter Hermann
2000-05-25  0:00                         ` 'img Keith Thompson
2000-05-25  0:00                           ` 'img Ted Dennison
2000-05-26  0:00                         ` 'img dmitry
2000-05-26  0:00                           ` 'img Brian Rogoff
2000-05-26  0:00                             ` 'img Robert Dewar
2000-05-26  0:00                           ` 'img Robert Dewar
2000-05-19  0:00         ` C vs. Ada - strings Geoff Bull
2000-05-19  0:00           ` mike
2000-05-21  0:00           ` Robert Dewar
2000-06-03  0:00           ` Pete
2000-06-03  0:00             ` Java vs. Ada - strings (was: C vs. Ada - strings) Ted Dennison
2000-06-04  0:00               ` Robert I. Eachus
2000-06-04  0:00               ` Pete
2000-06-04  0:00                 ` Jean-Pierre Rosen
2000-06-04  0:00                   ` Pete
2000-06-05  0:00                     ` Jean-Pierre Rosen
2000-06-05  0:00                 ` Ted Dennison
2000-06-05  0:00                   ` Marin D. Condic
2000-06-05  0:00                     ` David Botton
2000-06-05  0:00                       ` Marin D. Condic
2000-06-06  0:00                     ` Robert A Duff
2000-06-06  0:00                   ` Ken Garlington
2000-06-06  0:00                     ` Marin D. Condic
2000-06-03  0:00             ` C vs. Ada - strings Ken Garlington
2000-06-03  0:00               ` Ted Dennison
2000-06-04  0:00                 ` Dale Stanbrough
2000-06-04  0:00                 ` Ken Garlington
2000-05-03  0:00   ` Wes Groleau
2000-05-03  0:00     ` Ted Dennison
2000-05-04  0:00   ` Ole-Hjalmar Kristensen
2000-05-04  0:00     ` Gautier
2000-05-02  0:00 ` Larry Kilgallen
2000-05-05  0:00 ` Florian Weimer
2000-05-05  0:00   ` Ted Dennison
2000-05-05  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