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 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-03 05:22:17 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!not-for-mail Message-ID: <3F7D69EA.5030707@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) 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: <3F7AC5B0.9080108@noplace.com> <3F7B7641.9030908@noplace.com> <3F7C8482.20102@comcast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 03 Oct 2003 12:22:16 GMT NNTP-Posting-Host: 165.247.66.247 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1065183736 165.247.66.247 (Fri, 03 Oct 2003 05:22:16 PDT) NNTP-Posting-Date: Fri, 03 Oct 2003 05:22:16 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:150 Date: 2003-10-03T12:22:16+00:00 List-Id: O.K. but how is that any different/better if the underlying implementation of Surname were to be a String? Here's my point: In the process of doing whatever programming might be going on underneath Surnames, if I have a type String - I can make use of all the things that just naturally work in Ada with no additional effort. Examples include literals, attributes or other functions that return String, utilizing Text_IO, etc. The instant I go to Bounded_String, I'm with'ing a package, making a generic instantiation, diddling around with type conversions, etc. I'm not compatible with Text_IO or other things without a conversion and I'd bet dollars to doughnuts that most database interfaces are going to make you read/write a String rather than a Bounded_String - so you've got type conversion hassle again there anyway. And what do I get for the extra effort? I get to know the actual length of the text stored in there rather than have to go figure that out for myself by scanning backward from the end of the string or maintaining my own counter. I get X amound of nuisance and Y amount of extra advantage. Normally, when I do the math, X - Y is greater than zero. Hence I just use type String and am done with it. It changes *nothing* in terms of what is happening in the underlying implementation because a Bounded_String is just a fixed length string with a "Last" counter coasting along with it. I can do that myself and still have visibility to the fixed string as a String - compatible with all the usual Ada stuff. Or I go to my beloved Unbounded_String and have infinite amount of space to play with and no restrictions to get in my way. All it costs me is a little time. :-) MDC Robert I. Eachus wrote: > > Yes, as I said, in database work, the nice thing about instantiating > Bounded_String for each data dictionary string item is that the value > gets checked for validity at the right point--where it can be fixed. > Once you have validated it, the string is never going to grow outside > the bounds, so you don't have to worry about checking again. In other > words, the visible interface of the package that deals with say surnames > may be: > > package Surnames is > > type Surname is private; > > function To_Surname(S: in String) return Surname; > > function Get(S: in Surname) return String; > > private... > > The only legitimate way to create a surname is by calling To_Surname, > which does the error checking. > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m c o n d i c @ a c m . o r g "All reformers, however strict their social conscience, live in houses just as big as they can pay for." --Logan Pearsall Smith ======================================================================