comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Protected Types and Address Clauses
Date: 1996/02/23
Date: 1996-02-23T00:00:00+00:00	[thread overview]
Message-ID: <Dn8uEM.4B8@world.std.com> (raw)
In-Reply-To: 4gi71p$94s@wdl1.wdl.loral.com

In article <4gi71p$94s@wdl1.wdl.loral.com>,
Mark A Biggar <mab@dst17.wdl.loral.com> wrote:
>That's not a work around, it is the necessity and proper implementation
>method in almost all cases.

I agree it's not a workaround.  It's perfectly reasonable to use
protected objects to protect stuff that's not inside the protected
object.  This case (with the address clause) is one case where it
really can't be inside.  There are other cases.

I'm not sure what you mean by "in almost all cases".  I think it's
*usually* best to put the stuff being protected inside the protected
object.  I guess you mean, "in almost all cases where the thing being
protected needs to be located at a particular address".

One useful technique (probably not applicable in this case, but in
others) is to have a component of the protected object be a pointer to
the stuff being protected.  For example, the PO can have an access
discriminant:

    type Stuff is ...
    
    protected type P(S: access Stuff) is ...
    
    X: Stuff;
    
    PO1: P(S => X'Access); -- protect a pre-existing thing
    
    PO2: P(S => new Stuff'(...));

- Bob




  reply	other threads:[~1996-02-23  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4fqe6h$t0e@theopolis.orl.mmc.com>
1996-02-19  0:00 ` Protected Types and Address Clauses Robert I. Eachus
1996-02-20  0:00   ` Norman H. Cohen
1996-02-21  0:00     ` Keith Thompson
1996-02-21  0:00     ` Robert Dewar
1996-02-22  0:00       ` Keith Thompson
1996-02-22  0:00         ` Mark A Biggar
1996-02-23  0:00           ` Robert A Duff [this message]
1996-02-21  0:00   ` Robert I. Eachus
     [not found] <DMrJAC.788@thomsoft.com>
1996-02-21  0:00 ` Bob Gilbert
replies disabled

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