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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f868292008c639ce X-Google-Attributes: gid103376,public From: dale Subject: Re: C vs. Ada - strings Date: 2000/05/18 Message-ID: #1/1 X-Deja-AN: 624837779 References: <390F0D93.F835FAD9@ftw.rsc.raytheon.com> <8en5o9$ihe$1@nnrp1.deja.com> <8eonos$e70$1@wanadoo.fr> <1fIU4.4668$Rx3.250161@typhoon.nyroc.rr.com> X-Trace: 18 May 2000 16:22:06 GMT, dale.cs.rmit.edu.au Organization: rmit User-Agent: MT-NewsWatcher/3.0 (PPC) Newsgroups: comp.lang.ada Date: 2000-05-18T00:00:00+00:00 List-Id: Pete wrote: > really both versions aren't that great. java strings are much better. if > s > and t are strings of different lengths, suppose > s = "junk"; > t = "garbage". it should make sense to write s = s + t; and your result > is > "junkgarbage" as java does. you should definitely not have to make sure > that > s is big enough to hold a string of length s and t or call any function > to > reallocate memory. it should happen automatically, under the covers. You should try unbounded_strings, as this gives you the flexibility that you seem to want. the > most annoying thing in ada is the output messages. i'm not sure what you mean by "output messages". if you write > Positive'Image("5"). You get back > " 5", with a space for an optional - sign, even though it is a positive > number! or even worse, (should read Positive'Imge (5)) i've always thought of attributes such as these as rather low level features good for debugging, but not really of much use for fancy formatting. Still it can be annoying. You have to apply the trim function, or slice the array yourself, which is annoying. instantiate a generic package to handle printing > of > numbers, instead of > System.out.println("This is junk " + i); (where i is a numeric type). Yes, but with this simplicity you get a very real problem - the inability to define new distinct numeric types. Which do you think is the bigger problem - having to choose b/w int and long for almost all integer work (without the ability to have unsigned ints), or having to instantiate (or do a type conversion) to get output? Note that you could always include your own package of functions to get exactly the same behaviour as you see above in Java. Dale