comp.lang.ada
 help / color / mirror / Atom feed
From: John G. Volan <John_Volan@ccmail.dayton.saic.com>
Subject: Re: Package Parts [was: Ada GC and a bunch of other stuff]
Date: 1996/02/22
Date: 1996-02-22T00:00:00+00:00	[thread overview]
Message-ID: <4gh5lb$htq@dayuc.dayton.saic.com> (raw)
In-Reply-To: 4gh2da$ffb@dayuc.dayton.saic.com

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 <name> separate ( <identifier> {, <identifier> } );
    
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 <name> ( <identifier> ) is
        { <basic-declaration> ; }
    private
        { <basic-declaration> ; }
    end <name> ( <identifier> );
    
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 <name>(<identifier>) 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 <name> ( <identifier> );
    
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? :-) " );
------------------------------------------------------------------------




  reply	other threads:[~1996-02-22  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <NEWTNews.824443067.649.geneo@medusa.ppp.rational.com>
1996-02-18  0:00 ` Package Parts [was: Ada GC and a bunch of other stuff] Ken & Virginia Garlington
1996-02-21  0:00   ` John G. Volan
1996-02-22  0:00   ` John G. Volan
1996-02-23  0:00     ` Robert A Duff
1996-02-22  0:00   ` John G. Volan
1996-02-23  0:00     ` Robert A Duff
1996-02-22  0:00 ` John G. Volan
1996-02-22  0:00   ` John G. Volan [this message]
1996-02-23  0:00   ` Robert A Duff
1996-02-23  0:00 ` Robert I. Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox