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,e07818d50a32cdd7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-04 15:01:04 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!news.huji.ac.il!not-for-mail From: "Ehud Lamm" Newsgroups: comp.lang.ada Subject: Re: Constraint error? Date: Tue, 5 Jun 2001 00:44:51 +0300 Organization: The Hebrew University of Jerusalem Message-ID: <9fgvts$l8r$1@news.huji.ac.il> References: <0SSS6.4214$v4.215546@www.newsranger.com> NNTP-Posting-Host: di2-84.dialin.huji.ac.il X-Trace: news.huji.ac.il 991691517 21787 132.64.12.84 (4 Jun 2001 21:51:57 GMT) X-Complaints-To: abuse@news.huji.ac.il NNTP-Posting-Date: Mon, 4 Jun 2001 21:51:57 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Xref: archiver1.google.com comp.lang.ada:8101 Date: 2001-06-05T00:44:51+03:00 List-Id: Ted Dennison wrote in message news:0SSS6.4214$v4.215546@www.newsranger.com... > In article , Robert A Duff says... > >I don't disagree with any of your advice. But I couldn't resist pointer > >out that string handling is a pain in Ada as well. > > Well..perhaps you are more used to specialized string-handling languages than I > am. I don't find it a pain at all, as long as you can keep things in > perfectly-sized fixed strings. Generally, that is no problem, but I mostly do > system programming. I'll admit there are probably some domains where its a lot > tougher than I'm used to. > > So I guess I'm saying I disagree with you, but I might not have the whole > picture either. > I feel that we use the term string to refer to many different abstractions. In fact the only thing common to all of them is that they represent sequences of characters (even the character set question opens a can of worms). I rememeber that working with Rexx on an IBM mainframe I kept thinking "hell, Snobol or Perl are much more powerful when it comes to strings." - since the Rexx parse command is basically better suited to handle strings with fixed layout. But this is the kind of records you usually find in the kind of world Rexx was (originally) created for. Now consider the confusion of someone coming from a Pascal or C background, and seeing Ada strings for the first time. They are called strings so he is sure that they are basically the same abstraction as he is used to. So the C hacker will try to insert \0 all over the place, and think that legnth should be found using something like strlen. 'length is going to look crzay as hell, always returning the same length... The Pascal programmer implicitly assumes that strings remember their current length, shrinking and expanding as needed. The Ada string type, being an unconstrained array type, is of course different than both of these. Is it more natural to use? I don't think so. This is not meant as a criticism. The other approaches described above are unnatural too - only some times people learn them first. I think that most poeple looking from a fresh point of view on the problem would want some form of unbounded strings. Most language designers find such strings too abstract, and prefer to start from more basic array of characters types. This usually means that the library supplied string types (like Unbounded in Ada) are less elegant to use, and don't have as nice a syntax. This is one reason why string handling languages are usually niche languages, with specially designed syntax, suporting a richer string abstraction. P.S But do check the GNAT Spitbol packages. -- Ehud Lamm mslamm@mscc.huji.ac.il http://purl.oclc.org/NET/ehudlamm <== Me!