comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Ada 83 - Rep clause inside private area question
Date: 1997/04/20
Date: 1997-04-20T00:00:00+00:00	[thread overview]
Message-ID: <dewar.861566327@merv> (raw)
In-Reply-To: mheaney-ya023680002004971026380001@news.ni.net


matthew Heaney said

<<You only do rep specs when you're doing some kind of I/O - either to
another language or to an external hardware device.  Since this is a
low-level thing, you don't need to bother with any more abstraction by
putting the rep spec in the private part.
>>


This is quite wrong. There are many reasons for using rep clauses (I assume
that Matthew means rep clauses wwhen he says rep specs -- this is a very
common bit of incorrect terminology).

Examples are a small clause, which has an important effect on the semantics
and surely should be in the visible part.

Pack used to save space, this generally need NOT be in the public part
since it typically is not part of the logical interface.

A storage pool rep clause for an access type is certainly another example
of something that has nothing to do with I/O ..

Another example is

  for Reliable_Boolean use (2#01010101#, 2#10101010#) to get a Boolean
type whose representation is not single bit sensitive.

There are MANY other examples of the use of rep clauses which have nothing
to do with IO or interfacing, Matthews characterization is FAR too narrow.

He also said

<<There's a debate about this very issue among Ada programmers.  Some like to
push the rep specs off into the private region, arguing that a client
shouldn't really care.  Others (myself among them) believe that the rep
spec should be in the public part, because the representation is an
essential characteristic of the type.

>>


But this too may be affected by his far too narrow view of rep clauses.
Generally the issue of whether rep clauses go in the private part or not
is one of whether the rep clause is or is not part of the legitimate
interface which you want clients to be able to depend on. Sometimes the
answer is yes, sometimes the answer is no. Matthew said that his answer
is always yes, but an answer of yes is clearly inappropriate in some
of the above examples, and in many other examples.





      reply	other threads:[~1997-04-20  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-18  0:00 Ada 83 - Rep clause inside private area question Angelo A. Keene
1997-04-20  0:00 ` Matthew Heaney
1997-04-20  0:00   ` Robert Dewar [this message]
replies disabled

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