[comp.lang.ada] Use of operators on limited private types . . .

KETTERING@SPIKE.llnl.gov (Brett 'Volleyball is my game' Kettering) (08/02/90)

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