comp.lang.ada
 help / color / mirror / Atom feed
From: stt@henning.camb.inmet.com (Tucker Taft)
Subject: Re: Simplifying Unbounded_Stri
Date: Wed, 22 Mar 1995 05:21:20 GMT
Date: 1995-03-22T05:21:20+00:00	[thread overview]
Message-ID: <D5ttJK.K8E@inmet.camb.inmet.com> (raw)
In-Reply-To: 3khc1s$2bt@dmsoproto.ida.org

David Wheeler (wheeler@ida.org) wrote:

: I'm looking for some advice on how to simplify Unbounded_String
: handling. Discussion and source code follows.
..

I would recommend the following:

   with Ada.Strings.Unbounded;
   use Ada.Strings.Unbounded;
   package Unbounded_Converters is
       function "+"(From : String) return Unbounded_String renames
          To_Unbounded_String;
       function "+"(From : Unbounded_String) return String renames
          To_String;
   end Unbounded_Converters;

And then a user of unbounded strings can:
   with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
   with Unbounded_Converters; use Unbounded_Converters;

Now they have a convenient unary operator "+" for converting back
and forth between unbounded strings and strings, meaning that there
is no particular reason to create separate routines for unbounded
string output.  You might still want a version of Get_Line which
didn't bother to go through String, so you might want to add this
to your package.

I don't see the need to define a child package, and as you mention,
implementations are allowed to limit the creation of child packages
of implementation-provided packages (though I doubt that many will
impose such limitations).

-Tucker Taft  stt@inmet.com
Intermetrics, Inc.




      reply	other threads:[~1995-03-22  5:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-19 13:37 Simplifying Unbounded_Stri David Wheeler
1995-03-22  5:21 ` Tucker Taft [this message]
replies disabled

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