From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,98dbc8f279df5afc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-10 13:57:44 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!wn14feed!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Message-ID: <3F871D26.7080705@comcast.net> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A nongeneric bounded string array type References: <3F86E9DE.4070000@comcast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.34.139.183 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc51.ops.asp.att.net 1065819463 24.34.139.183 (Fri, 10 Oct 2003 20:57:43 GMT) NNTP-Posting-Date: Fri, 10 Oct 2003 20:57:43 GMT Organization: Comcast Online Date: Fri, 10 Oct 2003 20:57:44 GMT Xref: archiver1.google.com comp.lang.ada:648 Date: 2003-10-10T20:57:44+00:00 List-Id: Stephen Leake wrote: > "Robert I. Eachus" 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