comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: A nongeneric bounded string array type
Date: Fri, 10 Oct 2003 20:57:44 GMT
Date: 2003-10-10T20:57:44+00:00	[thread overview]
Message-ID: <3F871D26.7080705@comcast.net> (raw)
In-Reply-To: u3ce1f0gp.fsf@nasa.gov

Stephen Leake wrote:
> "Robert I. Eachus" <rieachus@comcast.net> writes:
> 
> 
>>Warren W. Gay VE3WWG wrote:
>>
>>
>>>One of the things that discourages me from using Bounded_Strings is
>>>the number of instantiations that you end up making (for each
>>>different string size). I would have preferred one instantiation,
>>>and then a discriminant that set the maximum size on the object.
>>>But that may have problems of its own.
>>
>>Ask, and it shall be given unto you; seek, and you shall find; knock,
>>and it shall be opened to you. -- Matthew 7:7
>>
>>Sorry, I couldn't resist.  Here is a package with NO instantiations,
>>and a bounded array type that can handle different length strings.

> Well, I don't think I've ever needed a container of strings (which is
> one way to describe this thing). I've needed symbol tables and such,
> which contain strings, but also contain other things.

The usual case where I have been using Ada.String.Bounded is when I am 
doing a database query (often from a web page) and displaying the 
results.  (I should probably use AWS, but I'm lazy, and I have been 
using uncgi directly from Ada for a long time.)  With this type I can 
just have the query return a Bounded_String_Array and display it.

>>You had better believe that if this pattern is this hard to find, it
>>probably belongs in the standard, rather than in my back pocket. 
> 
> Hmm. If someone said to me "please write a container of strings, in
> Ada 83, with no dynamic memory allocation", this is probably what I
> would have come up with.

Um, Ada.Strings.Bounded is what I came up with.  But finally, someone 
asked for a container that can be used for "ragged" string arrays, 
without using generics.

The hard part was realizing that it wasn't impossible.  I had just 
finished writing something that implied it wasn't impossible, so I did 
it.  And once you realize that it is possible, elegant packaging isn't 
hard.

It is just like asking someone to design a transportation system from 
here to the moon--that doesn't use rockets.  With beanstalks and tether 
systems it is possible, but lots of people would look at the conditions, 
say that's crazy, and not even try.  (Incidently carbon nanotube 
technology looks like it will make Earth beanstalks not only possible, 
but practical.  A Martian beanstalk or a lunar beanstalk though the L1 
Lagrange point are both highly practical even with just Kevlar.)

-- 
                                                     Robert I. Eachus

"Quality is the Buddha. Quality is scientific reality. Quality is the 
goal of Art. It remains to work these concepts into a practical, 
down-to-earth context, and for this there is nothing more practical or 
down-to-earth than what I have been talking about all along...the repair 
of an old motorcycle."  -- from Zen and the Art of Motorcycle 
Maintenance by Robert Pirsig




  reply	other threads:[~2003-10-10 20:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-10 17:18 A nongeneric bounded string array type Robert I. Eachus
2003-10-10 17:48 ` Stephen Leake
2003-10-10 20:57   ` Robert I. Eachus [this message]
2003-10-15  3:28   ` Matthew Heaney
2003-10-16  9:33     ` Jean-Pierre Rosen
2003-10-16 18:04       ` Jeffrey Carter
2003-10-17  7:30         ` Jean-Pierre Rosen
2003-10-17  0:51 ` sk
replies disabled

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