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,be23df8e7e275d73 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-13 16:06:59 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.stealth.net!news-east.rr.com!news.rr.com!chnws02.mediaone.net!chnws06.ne.mediaone.net!24.128.8.202!typhoon.ne.mediaone.net.POSTED!not-for-mail Message-ID: <3B4F7F3A.957924C4@mediaone.net> From: Ed Falis X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.3 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: About private types and reusability? References: <0zS27.187213$DG1.31590366@news1.rdc1.mi.home.com> <3B4F4BAC.D53B9555@PublicPropertySoftware.com> <9inlsv$m7l$1@nh.pace.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 13 Jul 2001 23:06:55 GMT NNTP-Posting-Host: 65.96.132.248 X-Complaints-To: abuse@mediaone.net X-Trace: typhoon.ne.mediaone.net 995065615 65.96.132.248 (Fri, 13 Jul 2001 19:06:55 EDT) NNTP-Posting-Date: Fri, 13 Jul 2001 19:06:55 EDT Organization: Road Runner Xref: archiver1.google.com comp.lang.ada:9931 Date: 2001-07-13T23:06:55+00:00 List-Id: Didier Utheza wrote: > There was an interesting comparison on the net of c++, Ada95 and Modula3. > The only critic of Ada was about the inclusion of the description of the > private type in the specification rather than the body of the module. > Modula3 keeps everything private in the body. I know that it was question > to create a third type of file that would have described the private type. > The idea was abandoned because having to deal with three files for one > module will not have simplify things. So my question, if anybody has an > answer, is why this choice. The inclusion of the private type defenition > in the body should keep things modular. The specifications describing to > the user the method to access the object in a transparent way. By > including the private type def. in the specifications, any following > change means that you not only have to recompile the module but also the > whole program since the specifications changed. Where is the advantage? > Thanks for any answer. > Didier Utheza. My understanding is that this is an efficiency tradeoff to some extent. The private part of the spec provides information needed by the compiler so that private types would not need to always involve an extra indirection into the body definition. You can, of course, get around it (ie reduce recompilation) by associating an access type explicitly to an incomplete type whose defiinition is in the package body. The presence of this "representation" information in the private part to the compiler when it processes client code also aids optimization. I believe I've heard Tucker Taft use the analogy of logical and physical interface for the public and private parts of a spec. I like that analogy. - Ed