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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,45b47ecb995e7a3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-14 08:45:13 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!psinet-eu-nl!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Ada Idioms Progress Preview Date: Tue, 14 Aug 2001 11:33:41 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9lbgcm$c42$1@nh.pace.co.uk> References: <3B6F1B2F.4FC3C833@gsde.hou.us.ray.com> <5ee5b646.0108071819.6e84e33d@posting.google.com> <3_Xc7.45$NM5.84779@news.pacbell.net> <9lb8mh$9am$1@nh.pace.co.uk> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 997803222 12418 136.170.200.133 (14 Aug 2001 15:33:42 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 14 Aug 2001 15:33:42 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:11922 Date: 2001-08-14T15:33:42+00:00 List-Id: Yeah, I've seen that trick before and it is really handy. Maybe a tad beyond what you want to teach a raw beginner at first, but certainly not that complex that it can't be used. Using it as a parameter to To_Unbounded_String can pretty much eliminate any problems with arbitrary limits or worrying about string sizes. The real string handling trick should be to illustrate one or more idioms for dealing with strings across a range of applications. Sort of saying "The Ada Way(tm)" for handling strings is to read them this way, manipulate them this way, then write them this way. An idiom should be given for the fixed strings and for things like Unbounded. Id est, if you always read in a string and immediately converted to Unbounded and wrote all string parameters, etc, as Unbounded and used To_String when heading for output, that is one idiom for apps where speed is not an issue. Another idiom would be to read them as fixed strings, but dynamically allocate them, then write all parameters to expect "String_Ptr.all" and use the attributes. Obviously, an Ada app gains something by always treating strings in *some* consistent manner. Many are possible. What ought to be the "preferred" way? MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Ted Dennison" wrote in message news:Cdbe7.947$2u.26361@www.newsranger.com... > > Martin Carlisle had a good solution for this, which is posted at AdaPower at > http://www.adapower.com/adacode.html. It uses recursion, but I don't think the > stack impact is much more than 2n where n is the string size. >