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,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-01 10:33:51 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!wn14feed!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc54.POSTED!not-for-mail Message-ID: <3F7B0FE2.6010906@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: Is the Writing on the Wall for Ada? References: <1064527575.648809@master.nyc.kbcfp.com> <3F739C1D.4030907@attbi.com> <3F78E850.8010401@comcast.net> <3F797748.3000203@noplace.com> <3F7AC1B4.304@noplace.com> 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: rwcrnsc54 1065029630 24.34.139.183 (Wed, 01 Oct 2003 17:33:50 GMT) NNTP-Posting-Date: Wed, 01 Oct 2003 17:33:50 GMT Organization: Comcast Online Date: Wed, 01 Oct 2003 17:33:50 GMT Xref: archiver1.google.com comp.lang.ada:73 Date: 2003-10-01T17:33:50+00:00 List-Id: Marin David Condic wrote: > Like I said, I've never personally used it for anything (and yes, I > do embedded work as well as other things) and I'm wondering if others > have actually used it in practice or do people just hop over to > Unbounded_String the instant the type String seems to be the wrong > answer. I initially invented what is now Bounded_String when I needed to create a ragged array of names in Ada. I posted it to the ARG list (so long ago it was actually the LMC list) in answer to someone saying "It would be nice to have the equivalent in Ada of PL/I's char(N) varying." There are some tricky bits to writing the package in Ada and making it would "right" and efficiently. You have to have two record types. The inner record type has a discriminant that doesn't depend on the outer. And defining the "&" overloadings is tricky--put in one too many and nothing works. But as it is you can write: package Bounded is new Ada.Strings.Bounded_String.Generic_Bounded_String(30); use Bounded; Foo: Bounded_String := Null_Bounded_String; Bar: String := "ABCD"; begin Foo := Foo & Bar; Put_Line(' ' & Foo); So I never understand all those complaints about explicitly converting to and from Bounded_String (or Unbounded_String). In any case, people kept remembering that I had some working solution to the problem of ragged arrays in Ada, and sending me e-mail to get a copy of the package. I probably rewrote it from memory a half-dozen times because I wasn't answering mail from a system where I had a copy. (The body of the package is trivial, the key part is in the private part of the spec.) Since lots of language experts would remember that there was a solution, but would e-mail me becuase they didn't remember the 'trick', it got added to Ada 95. Unbounded_String was essentially an argument by example for supporting Adjust for non-limited controlled types in Ada 95. -- 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