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.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!cme-durer!leake From: leake@cme-durer.ARPA (Stephe Leake) Newsgroups: comp.lang.ada Subject: limited private types Message-ID: <748@marvin.cme-durer.ARPA> Date: 29 Nov 88 15:12:22 GMT References: <44449@beno.seismo.CSS.GOV> <3563@hubcap.UUCP> <7882@nsc.nsc.com> <739@marvin.cme-durer.ARPA> <7796@aw.sei.cmu.edu> Organization: National Bureau of Standards, Gaithersburg, MD In-reply-to: dd@sei.cmu.edu's message of 23 Nov 88 13:37:52 GMT List-Id: In article <7796@aw.sei.cmu.edu> dd@sei.cmu.edu (Dennis Doubleday) writes: In article <739@marvin.cme-durer.ARPA> leake@cme-durer.ARPA (Stephe Leake) writes: >In article <7882@nsc.nsc.com> rfg@nsc.nsc.com (Ron Guilmette) writes >> I have some problems with limited private types too. Specifically, if such >> types are really only accessable through a "limited" functional interface, >> then why shouldn't we be able to declare such types in the public part of >> a package and then defer the full declaration until the package body? > >What would this gain? Do you have any specific examples where this >would have improved the readability or functionality of an >application? Let's not just suggest changes because they "sound good". >Let's put some thought into it, including concrete examples. There is a VERY good reason for it, if you're at all concerned about portability. The declaration of a limited private type is an IMPLEMENTATION decision. It doesn't belong in the specification, it belongs in the body. If I'm trying to export some abstract data type from a package, I'd like to have a specification that could be moved, intact, from one machine to another. Only the body should need changing. However, since I must give the full declaration of the type in the private part of the spec instead of in the body, it may be that I will have to change that part of the spec if I want to port the package to a machine which requires a different implementation of the type. This is true, but it doesn't allow separate compilation; you cannot compile bodies that use the limited private type untill the size of that type is known. One way around this is to declare the limited private type to be a pointer to a type whose full declaration is defered to the body of the package: package My_Private_Type type Hidden is limited private; ... private type Real_Hidden; type Hidden is access Real_Hidden; end My_Private_Type; Admittedly, access types are not the best in all situations, but this does enhance portability. >Why does your post sound so hostile? How do you know that Ron hasn't >put any thought into his suggested changes? I didn't mean to sound hostile, I was simply frustrated with the lack of information. If Ron was concerned with the issue you raised, he should have said so explicitly. Believing someone has good reasons, and knowing what those reasons are, are two different things. Stephe Leake (301) 975-3431 leake@cme.nbs.gov National Institute of Standards and Technology (formerly National Bureau of Standards) Rm. B-124, Bldg. 220 Gaithersburg, MD 20899