comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: User-defined access dereference
Date: Mon, 20 Aug 2001 14:26:24 GMT
Date: 2001-08-20T14:26:24+00:00	[thread overview]
Message-ID: <k69g7.7852$2u.56856@www.newsranger.com> (raw)
In-Reply-To: 3B7DB563.82D3F842@acm.org

In article <3B7DB563.82D3F842@acm.org>, Jeffrey Carter says...
>
>"Stanley R. Allen" wrote:
>> 
>> Now we are faced with another situation in which it would be nice to replace
>> ".all".  This time, there are over 10,000 dereferences in over a million 
>> lines of code, so it's out of the question to do to this code what was done 
>
>I think you should make your access type private. Then any dereferences,
>explicit or implicit, will be illegal, and the compiler will catch any
>you miss.

I'll heartily second that. Its generally a bad idea to give folks direct
visibility inside of a record structure declared in a package spec, and this is
*exactly* why. You should be able to change the internal structure of that
"object" at will. But since you provided its clients a "help-yourself" structure
rather than a private object, you now are seriously impeeded from making any
serious structural change. (the first "you" here is plural btw. I realise it
probably wasn't Stanley who wrote this bad code) 

My advice at this point would be to make the thing private, give it the proper
interface routines, then go fix (or better yet, make the package's original
author do this) every occurance in client code that the compiler flags. Consider
it the software equivalent of having to write "I will not export public data
structures" on the blackboard 10,000 times. :-)

As Ben Franklin said, "Experience is a dear teacher..."

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



  reply	other threads:[~2001-08-20 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-17 23:54 User-defined access dereference Stanley R. Allen
2001-08-18  0:23 ` Jeffrey Carter
2001-08-20 14:26   ` Ted Dennison [this message]
2001-08-18  5:48 ` Dave Adlam
replies disabled

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