comp.lang.ada
 help / color / mirror / Atom feed
From: KETTERING@SPIKE.llnl.gov (Brett 'Volleyball is my game' Kettering)
Subject: Use of operators on limited private types . . .
Date: 2 Aug 90 15:20:00 GMT	[thread overview]
Message-ID: <56A72BEBE52F8004CF@icdc.llnl.gov> (raw)

With regards to Message-ID: <1152@cs.nps.navy.mil>
from cs!erickson@lll-winken.llnl.gov  (David Erickson)

David writes

>Is there any way to define "=" for a limited private type which is an
>access type (which may be null)?  The problem arises trying to test for
>null without producing an infinitely recursive definition.

According to my understanding of the philosophy of Ada the client of a
limited private type should not have that particular operator, along with
all the others, to use.  It is the responsibility of the package that exports
that limited private type to provide all of these functions to the client as
that package sees fit.

So in your case above perhaps the package that exports the limited private
type, which is a pointer, may want to provide a function IS_NULL and
a procedure DESTROY.  By this manner you don't care that it is a pointer and
needs to have its object deallocated.  The package does that for you.

If on the other hand your concern is about a limited private type that is
a generic formal parameter to some package then that package should also
have generic formal parameters that are the function and the procedure I
mentioned in the previous paragraph.  In this manner the client of the package
tells the package about his limited private type and how to manipulate it.

Brett M. Kettering
KETTERING@SPIKE.llnl.gov

                 reply	other threads:[~1990-08-02 15:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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