comp.lang.ada
 help / color / mirror / Atom feed
From: rgilbert@polaris.orl.mmc.com (Bob Gilbert)
Subject: Re: Question about record rep spec placement
Date: 1997/01/17
Date: 1997-01-17T00:00:00+00:00	[thread overview]
Message-ID: <5bof0o$q0i@zeus.orl.mmc.com> (raw)
In-Reply-To: 32DF9F55.7EA3@lmtas.lmco.com


In article <32DF9F55.7EA3@lmtas.lmco.com>, Ken Garlington <GarlingtonKE@lmtas.lmco.com> writes:
> Bob Gilbert wrote:
> > 
> > What possible purpose would placing the record rep spec in the
> > private section serve when the record is not a private type?
> 
> (1) Indicates to the user of the code that it's not smart to make
> assumptions regarding the internal organization of the type

Well, I guess there is a readability issue, but it seems like an
abuse of the private declaration section.  If I were looking at
code where this was done, I would question what the user had
intended.  If you really don't want the user to make assumptions
regarding the internals of the type, why not just go ahead and
make it a private type?  Placing the rep spec of a non-private 
type in the private section (if allowed) does not communicate any 
information to the compiler and may confuse the reader.  Seems 
like some judicious use of comments might be in order.

> (2) We have a tool that takes Ada code and inserts it into documentation
> developing using the Interleaf document processor. It makes keywords
> bold, and all of that, and it also has an option to suppress listing the
> information in the private section. So, if we don't want details to appear
> in our user documentation, we put it in the private section.

Okay, but it still seems like a kludge and an abuse to me.  

That said, I do admit that sometimes having to include rep specs in
the same declaration list as the entity it refers to, adds unnecessary
verbosity to a package specification where the user would probably
have little or no use for the knowledge of the type's representation.
It might be useful to somehow identify a type as requiring a rep
spec, but be able to provide the details elsewhere (say within
the package body, or a representation section that works similar to
the private section).  Say something like: <hair-brained idea mode on>

  type T is {whatever};
  for type T use private;  -- Tell the user and compiler to look for
                           -- further specifics about T's representation
                           -- elsewhere in the package, perhaps even in
                           -- the package body.

-Bob






  reply	other threads:[~1997-01-17  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-15  0:00 Question about record rep spec placement Ken Garlington
1997-01-15  0:00 ` Bob Gilbert
1997-01-16  0:00   ` Fergus Henderson
1997-01-17  0:00   ` Ken Garlington
1997-01-17  0:00     ` Bob Gilbert [this message]
1997-01-17  0:00       ` Robert A Duff
1997-01-17  0:00         ` Ken Garlington
1997-01-18  0:00           ` Robert A Duff
1997-01-18  0:00             ` Ken Garlington
1997-01-19  0:00               ` Robert A Duff
1997-01-21  0:00         ` Bob Gilbert
1997-01-22  0:00           ` Ken Garlington
1997-01-23  0:00             ` Art Schwarz
1997-01-25  0:00               ` Ken Garlington
1997-01-24  0:00             ` Bob Gilbert
1997-01-25  0:00               ` Ken Garlington
1997-01-20  0:00       ` Ken Garlington
1997-01-15  0:00 ` Norman H. Cohen
1997-01-16  0:00   ` Ken Garlington
1997-01-17  0:00     ` Robert A Duff
1997-01-18  0:00       ` Ken Garlington
1997-01-16  0:00 ` Jeff Creem
1997-01-16  0:00 ` Jerome Desquilbet
replies disabled

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