comp.lang.ada
 help / color / mirror / Atom feed
From: erickson@cs.nps.navy.mil (David Erickson)
Subject: Re: limited private types, "=" operator
Date: 3 Aug 90 16:01:06 GMT	[thread overview]
Message-ID: <1160@cs.nps.navy.mil> (raw)
In-Reply-To: 10687@crdgw1.crd.ge.com

In article <10687@crdgw1.crd.ge.com> kassover@minerva.crd.ge.com (David Kassover) writes:
>In article <1152@cs.nps.navy.mil> erickson@cs.nps.navy.mil (David Erickson) 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.
>|
>|The only solution that I am aware of is to use UNCHECKED_CONVERSION to
>|retype the access type during the test for null, but this is a hack.
>|Is there a cleaner solution?
>|
>
>Export from the package defining the limited type a function that
>returns TRUE if the access type variable is not null.  Or the other way
>around, if you prefer.
>
>--
>David Kassover             "Proper technique helps protect you against
>kassover@ra.crd.ge.com	    sharp weapons and dull judges."
>kassover@crd.ge.com			F. Collins


This will not work in this case.  I specifically need to define "="
for a list which is implemented as a linked list.  In this case, "="
should return true if the two lists being compared are the same length
and the contents of each node are equal.  The user should not be aware
that the implementation uses pointers.  The problem is that I cannot
find a way to use the predefined "=" to test for null in the definition
for "=" that I am exporting.  According to the ARM, the predefined "="
is implicitly declared immediately after the type declaration, prior to
the next statement.  However, my declaration of "=" supersedes the
implicit "=", and I can think of no way to capture the implicit "=".

-Dave Erickson



Erickson@cs.nps.navy.mil

  reply	other threads:[~1990-08-03 16:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-08-01 18:47 limited private types, "=" operator David Erickson
1990-08-02  3:34 ` mackey
1990-08-02 17:46 ` David Kassover
1990-08-03 16:01   ` David Erickson [this message]
1990-08-04  0:01 ` Charles H. Sampson
1990-08-09 17:19 ` Clay Johnson
1990-08-10 16:20   ` David Erickson
  -- strict thread matches above, loose matches on Subject: below --
1990-08-02 13:44 "Norman H. Cohen"
replies disabled

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