comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Amey <peter.amey@praxis-cs.co.uk>
Subject: Re: What is the point of Private?
Date: Fri, 29 Apr 2005 10:07:29 +0100
Date: 2005-04-29T10:07:29+01:00	[thread overview]
Message-ID: <3debqiF6s66aeU1@individual.net> (raw)
In-Reply-To: <nEhce.952$HL2.627@newsread3.news.pas.earthlink.net>



Jeffrey Carter wrote:
> Simon Smith wrote:
> 
>> Why is it there? I am sure I have heard talk that its to stop the 
>> client from seeing exactly how the data is stored/manipulated however 
>> if people really did want to know this wouldn't they just scroll down 
>> the ada spec file and find out for themselves or am I missing 
>> something here?
> 
> 
> No, it was there originally to put stuff that the compiler needs to know 
> to compile client code, but that the client code doesn't need to know to 
> use the package. (Actually, the compiler probably doesn't need to know 
> that stuff, and it could be put in the body, but in the late 1970's 
> Ada's designers weren't willing to accept the extra work and overhead 
> that would entail.)

I think there are real compiler design issues here.  Modula 2 had 
"opaque types" which were conceptually similar to private types. 
However, Modula 2 had no equivalent of a package's private part which 
meant that the size of the opaque type wasn't known and that all 
implementations therefore required an opaque type to be implemented as a 
pointer.  Ada's scheme means the size is known to the compiler from the 
package spec alone.


> 
> Now, it also serves to put stuff that will be visible to the private 
> parts and bodies of children, but not to anyone else.
> 

Which is rather useful!

Peter




  reply	other threads:[~2005-04-29  9:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-28 23:22 What is the point of Private? Simon Smith
2005-04-28 23:40 ` Ed Falis
2005-04-29  3:14 ` Jeffrey Carter
2005-04-29  9:07   ` Peter Amey [this message]
2005-04-30  3:27     ` Jeffrey Carter
2005-04-30  0:49 ` chris
2005-05-01 22:57   ` Simon Smith
replies disabled

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