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.5 required=5.0 tests=BAYES_00,INVALID_MSGID, LOTS_OF_MONEY,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,f868292008c639ce X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: Java vs. Ada - strings (was: C vs. Ada - strings) Date: 2000/06/04 Message-ID: <8hecs2$295$1@wanadoo.fr>#1/1 X-Deja-AN: 631011247 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> <3924B730.AFB52C1C@acenet.com.au> <39394E0B.75BD479C@telepath.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@wanadoo.fr X-Trace: wanadoo.fr 960149186 2341 193.250.42.80 (4 Jun 2000 20:06:26 GMT) Organization: Adalog X-MSMail-Priority: Normal NNTP-Posting-Date: 4 Jun 2000 20:06:26 GMT Newsgroups: comp.lang.ada Date: 2000-06-04T20:06:26+00:00 List-Id: Pete a �crit dans le message : LVu_4.10342$kf5.70362@typhoon.nyroc.rr.com... > > > type String_Ptr is access String; > > type String_List is array (Natural range <>) of String_Ptr; > > AR : constant String_List := (new String'("have"), new String'("a"), new > > String'("good"), new String'("day")); > > my whole point is the complexity of the syntax. compare the above to > String st[] = new String[] { "have", "a", "good", "day"}; > The ada code above has two new types in order to process an array of > *primitive* types. > 1) String is not a "primitive" type in Ada. Actually, I don't know other languages where String is *not* recognized specially by the compiler. This means that all the nice features of strings are available for any user-defined array type. There is a price for such generality and power. 2) The Java syntax is nice - only at initialisation time. You have no aggregates in Java, so the corresponding syntax would not be allowed if you wanted to put other values in the array after initialisation. In short: your example is simpler in Java, in the particular case you mention. Any attempt to generalize it will result in more complicated stuff. -- --------------------------------------------------------- J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://pro.wanadoo.fr/adalog