comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: Need advice re package organization.
Date: Thu, 31 Jul 2003 22:33:31 GMT
Date: 2003-07-31T22:33:31+00:00	[thread overview]
Message-ID: <3F299920.9070603@attbi.com> (raw)
In-Reply-To: YTbWa.1378$qN3.184830@news20.bellglobal.com

Warren W. Gay VE3WWG wrote:

> Is this a show stopper? Well, no. But it has been long
> recognized in the software industry that information hiding
> promotes safety.  All I am saying, is that Ada95 seems to
> lack this feature and it should perhaps be more vigorously
> discussed ;-)


If I understand you correctly, what you would like is a syntax for 
saying that the components of an object can not be modified outside the 
package hierarchy, but can be read.

I can imagine a syntax for doing this, but it wouldn't add any safety. 
(If nothing else a user could use Unchecked_Conversion to declare a 
matching type.)

But the real problem is what I call unchecked perversion.  I coined the 
name the first time I saw a package specification that contained an 
instance of Unchecked_Conversion.  If a conversion between two types is 
made public like this, then any code in the entire project can depend on 
the equivalence, and changing the representation of the type may cause 
random errors elsewhere in the program.

In the case where I first ran into it, it was several conversions 
between Integer and an access type.  Of course, when we went to port the 
code, some of the access types by default would have used fat pointers. 
  We could force the types to use integer-sized pointers, but it was a 
pain.  The several weeks of work to fix the code would have been a 
bigger pain.  (If I were in the compiler business, I would have a very 
nasty warning when s package spec contained a visible instance of 
Unchecked_Conversion.)

So the advantage of supplying the inquiry functions is that you can 
later change the data layout, add new components, change 
representations, or even make some values which were originally explicit 
virtual.  I think a much better solution to your problem is a tool that 
automatically generates the inquiry functions from the type declaration. 
  Sounds like a good candidate for adding to the Emacs ada-mode.

-- 
"As far as I'm concerned, war always means failure." -- Jacques Chirac, 
President of France
"As far as France is concerned, you're right." -- Rush Limbaugh




  reply	other threads:[~2003-07-31 22:33 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-26 13:08 Need advice re package organization Bobby D. Bryant
2003-07-26 14:25 ` Robert I. Eachus
2003-07-26 15:27   ` Warren W. Gay VE3WWG
2003-07-26 22:00     ` Robert I. Eachus
2003-07-27 22:01       ` chris
2003-07-28  2:53         ` Robert I. Eachus
2003-07-29  4:52           ` Richard Riehle
2003-07-27 22:02       ` Warren W. Gay VE3WWG
2003-07-28  8:38         ` Dmitry A. Kazakov
2003-07-29 17:18           ` Warren W. Gay VE3WWG
2003-07-30  8:42             ` Dmitry A. Kazakov
2003-07-30 21:00               ` Warren W. Gay VE3WWG
2003-07-30 22:46                 ` Randy Brukardt
2003-07-31 16:39                   ` Warren W. Gay VE3WWG
2003-07-31 17:31                     ` Randy Brukardt
2003-07-31 21:00                       ` Warren W. Gay VE3WWG
2003-07-31 22:13                     ` Robert I. Eachus
2003-08-01 12:51                       ` Warren W. Gay VE3WWG
2003-07-31  5:57                 ` Matthew Heaney
2003-07-31 16:57                   ` Warren W. Gay VE3WWG
2003-07-31 22:33                     ` Robert I. Eachus [this message]
2003-08-01  2:58                       ` Chad R. Meiners
2003-08-01 13:51                         ` Stephen Leake
2003-08-01 22:15                           ` Robert I. Eachus
2003-08-04 13:45                             ` Stephen Leake
2003-08-01 13:01                       ` Warren W. Gay VE3WWG
2003-07-31  9:04                 ` Dmitry A. Kazakov
2003-07-31 16:59                   ` Warren W. Gay VE3WWG
2003-07-31 20:41                     ` Randy Brukardt
2003-07-31 21:15                       ` Warren W. Gay VE3WWG
2003-08-01 20:04                         ` Randy Brukardt
2003-08-01 21:33                           ` Stephen Leake
2003-08-04 19:40                             ` Randy Brukardt
2003-08-04 19:52                               ` Stephen Leake
2003-08-05  3:36                   ` Richard Riehle
2003-08-05  4:03                     ` Hyman Rosen
2003-08-05  7:16                     ` Dmitry A. Kazakov
2003-07-26 17:03 ` Nick Roberts
replies disabled

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