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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7903a7ed8de6a521 X-Google-Attributes: gid103376,public From: johnherro@aol.com (John Herro) Subject: Ada 95 Compatibility Date: 1996/02/22 Message-ID: <4gi8o8$an2@newsbf02.news.aol.com>#1/1 X-Deja-AN: 140653665 sender: root@newsbf02.news.aol.com organization: America Online, Inc. (1-800-827-6364) newsgroups: comp.lang.ada Date: 1996-02-22T00:00:00+00:00 List-Id: In Ada 95, a package spec. that doesn't *need* an corresponding body can't *have* one. Here's a simplified program segment that I wrote in Ada 83: package P is Buffer : array(1 .. 50) of Integer; end P; package body P is begin -- code to initialize Buffer end P; The buffer initialization is too complicated to do by initializing to an aggregrate in the package spec., such as one would do if initializing the buffer to all zeros. Here's how I rewrote the code for Ada 95; I'm wondering if I did it the best way: package P is Buffer : array(1 .. 50) of Integer; private procedure Init; end P; package body P is procedure Init is separate; begin Init; end P; separate (P) procedure Init is begin -- code to initialize Buffer end Init; There are other ways I could have done it. I could have made procedure Init public and required the main program to call it, but that sounds worse to me. I could have omitted the declaration of Init and instead declared procedure Dummy that does nothing but give me the opportunity to create a package body. The package body would contain "procedure Dummy is begin null; end Dummy;" which would never be called, and the package body would initialize Buffer just as in the Ada 83 example. This, too, seems worse than what I did. However, what I did in Ada 95 seems like a lot more lines of code that the Ada 83 version. Do you guys think I rewrote it the best way, or do you have other suggestions? Thanks. - John Herro Software Innovations Technology http://members.aol.com/AdaTutor ftp://members.aol.com/AdaTutor