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,8bb81cae35ee307f X-Google-Attributes: gid103376,public From: John G. Volan Subject: Re: Package Parts [was: Ada GC and a bunch of other stuff] Date: 1996/02/22 Message-ID: <4gh5lb$htq@dayuc.dayton.saic.com> X-Deja-AN: 140697834 distribution: world references: <31273ED6.B9B@flash.net> <4ggpkg$bl4@dayuc.dayton.saic.com> <4gh2da$ffb@dayuc.dayton.saic.com> content-type: text/plain; charset=ISO-8859-1 x-xxmessage-id: organization: Science Applications International Corp. (SAIC) mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-02-22T00:00:00+00:00 List-Id: In article <4gh2da$ffb@dayuc.dayton.saic.com> John G. Volan, John_Volan@ccmail.dayton.saic.com writes: >...I'd still prefer >it if a package-with-parts could be as "idempotent" as any other >package. That's why I'd favor some kind of special syntax that would >allow a package to enumerate its parts, rather than using some kind of >conventional Ada declaration (like an enumerated type) that requires a >prior declarative region to be declared in. How about this 7/8-baked counter-counter-proposal for Ada 0X? :-) Introduce a new kind of compilation unit called (let's say) a "package-spec configuration unit", with the following syntax perhaps: package separate ( {, } ); For instance, here's the configuration unit for the Stack package example: package Stack separate (Interface, Completion); This unit provides one handy place where all the package-spec-parts can be enumerated. Each individual package-spec-part implicitly imports this unit, and does not need to repeat the enumeration. Then we could have the following syntax for a package-spec-part: package ( ) is { ; } private { ; } end ( ); For example, the parts of the Stack package-spec would be: package Stack (Interface) is type Object is ... private; ... end Stack (Interface); package Stack (Completion) is private type Object is ... [full type declaration]; ... end Stack (Completion); If a compiler saw this () syntax, it would know that it was dealing with a package-spec-part, so it would look for the package-spec configuration unit in the library. That would enable it to determine the part's position in the sequence of parts, as well as the prior parts implicitly "withed" into that part. For backwards compatibility with Ada 95, we'd still support the existing syntax of single-part package specs, but this syntax would be mutually-exclusive with the multi-part syntax -- either you have a simple package spec, or you have one of those configuration units and the corresponding package-spec-parts. We'd also have the following alternative syntax for a "with" clause: with ( ); For example, a "partial" client of Stack could be: with Stack (Interface); package Partial_Client is ... and a "full" client could be: with Stack (Completion); package Full_Client is ... but given that Completion was the last part in the sequence, this would be considered equivalent to: with Stack; package Full_Client is ... A GNAT-like compiler could use a source-file naming convention something like the following: - p.ads would either contain a conventional single-part package-spec for package P, or it would contain a package-spec configuration unit for package P. - In the latter case, for every part-name X enumerated in p.ads, there should be a file p,x.ads containing package-spec-part P(X). (Note: I'm using "," to separate the part name vs. GNAT's "-" for child units. Various UNIXes I've tried seem to accept this, but I don't know whether other OS's (DOS, etc.) will like it.) - When a client says "with P;", the compiler will look for p.ads. If it finds an ordinary package spec there, it procedes as usual. But if it finds a package-spec configuration unit instead, the compiler will procede to "with" the whole sequence of p,x.ads package-spec-parts. - When a client says "with P(X);", the compiler will look for p,x.ads. It will also get file p.ads so it can determine P(X)'s position in the part sequence; it then will get the appropriate files for all the parts prior to P(X). ------------------------------------------------------------------------ Me : Person := (Name => "John G. Volan", E_Mail => "John_Volan@dayton.saic.com", Employer => "Science Applications International Corporation (SAIC)", Affiliation => "Enthusiastic member of Team-Ada!", Favorite_Slogan => "Ada95: The *FIRST* International-Standard OOPL", Shameless_Commercial_Plug => "RADSIM: Low-cost, real-time radar simulation *in Ada* " & "Check out: http://www.dayton.saic.com/aso_homepage.html ", Humorous_Language_Lawyerly_Disclaimer => "These opinions are undefined by my company, so any use of them" & "would be erroneous ... or is that a bounded error now? :-) " ); ------------------------------------------------------------------------