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,772ae8afc5db35f2 X-Google-Attributes: gid103376,public From: "Samuel T. Harris" Subject: Re: Can't export object of private type Date: 1999/02/26 Message-ID: <36D6CC3E.7FFAFC10@hso.link.com>#1/1 X-Deja-AN: 448762612 Content-Transfer-Encoding: 7bit References: <7b3f6v$lc1$1@nnrp1.dejanews.com> <7b5u87$s88$1@nnrp1.dejanews.com> <7b6f9k$at2$1@nnrp1.dejanews.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Raytheon Training Inc. Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-26T00:00:00+00:00 List-Id: bourguet@my-dejanews.com wrote: > > In article <7b5u87$s88$1@nnrp1.dejanews.com>, > robert_dewar@my-dejanews.com wrote: > ... > > The advantage of private parts is of course the nice > > compartmentalization. Indeed we have on the drawing boards > > for GNAT a feature to have the private parts in separate > > files which will be very handy for target specialization > > and indeed for general abstraction. > ... > > Well, this is a feature I'd like, especially if the compilation of > a unit "withing" the package can be compiled (and code generated) > without the private part. More or less like inter package inline > is currently handled by gnat: you have a performance gain if you accept > the dependancy but you may prefer the flexibility of the independancy... > well I'd even accept that all the program have to be compiled with the > same mode. > > -- Jean-Marc I can say from experience with the old Rational R1000 that such a facility is very powerful in dealing with variant code, especially code which varies because of target architectures to be supported. While the R1000 did not allow putting the private part in a separate file as, I believe, Robert is proposing, its delination of spec views and code views kept the private part in the code view (or at least that was the perceived affect). Thus changes to the private part of a package never caused a compilation hit on dependent units. Using private or limited types is clearly advantageous from a design level because dependent units have no visibility to the private type declaration. However, classical Ada compilers still have a compilation dependency. One can work around this by defining the private type as an access type to an incomplete type definition in the private part. In this case, one is allowed to complete the accessed type in the package body. While this eliminates the compilation dependency, it introduces a (sometimes unwanted) pointer. This construction allows one to hide all the variant details in the package body thus providing a single specification for all variations. This is a very important goal. Allowing the private part in a separate also file gives me the best of both. I avoid the recompilation hit and I don't have to use access types if I don't want to. I expect gnatchop will have an option to take existing source and split out the private part as appropriate. The reverse opertion will also be needed. Will the default file extension be xxx.adp? -- Samuel T. Harris, Principal Engineer Raytheon, Scientific and Technical Systems "If you can make it, We can fake it!"