From: "Norman H. Cohen" <ncohen@watson.ibm.com>
Subject: Re: Ada 83 versions of Ada 95 packages
Date: 1996/12/24
Date: 1996-12-24T00:00:00+00:00 [thread overview]
Message-ID: <32C058C6.50F3@watson.ibm.com> (raw)
In-Reply-To: 19961224202100.PAA15408@ladder01.news.aol.com
johnherro@aol.com wrote:
> I agree that the name of my package may be confusing, because what I
> really wrote was a *substitute* for unbounded strings for use with an Ada
> 83 compiler. I still hope that the package will prove useful to others.
But a discriminant named Length with no default value suggests that
every object of the type will be constrained to a particular length.
Thus there is no way to implement procedures such as Append,
Replace_Slice, and Delete that modify their Unbounded_String
parameters. That is what Robert Dewar meant when he said that this
looked like a fixed-length-string type.
The natural way to implement Unbounded_String in Ada 83 is with an
access-to-String type (adding an explicit Free operation as Robert
suggested).
The natural way to implement a Bounded_String type in Ada 83 is with a
record consisting of a fixed-length string (whose length is the maximum
length for the type) and a current-length component; Bounded_String
should be limited so that its "=" can be overridden to ignore string
components that are present in the record but not logically part of the
value. This means you will have to provide a Copy operation to replace
assignment, but that's desirable anyway to avoid unneeded copying. ("="
can be overridden for limited or nonlimited types in Ada 95, but only
for limited types in Ada 83.)
--
Norman H. Cohen
mailto:ncohen@watson.ibm.com
http://www.research.ibm.com/people/n/ncohen
next prev parent reply other threads:[~1996-12-24 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-12-23 0:00 Ada 83 versions of Ada 95 packages W. Wesley Groleau (Wes)
1996-12-24 0:00 ` johnherro
1996-12-24 0:00 ` Robert Dewar
1996-12-24 0:00 ` johnherro
1996-12-24 0:00 ` Robert Dewar
1996-12-24 0:00 ` Norman H. Cohen [this message]
1996-12-25 0:00 ` johnherro
1996-12-26 0:00 ` Keith Thompson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox