From: mackey@scs.fiu.edu
Subject: Re: limited private types, "=" operator
Date: 2 Aug 90 03:34:14 GMT [thread overview]
Message-ID: <1073@kluge.fiu.edu> (raw)
In-Reply-To: 1152@cs.nps.navy.mil
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?
>
>Thanks -
>
> Dave Erickson
The easiest way to solve this problem is not to say
type blurg is limited private
...
type blurg is access widget;
at all. Instead, say:
type blurg is limited private
...
type blurg_pointer is access widget;
type blurg is record
value : blurg_pointer;
end record;
Then, when you want to deal with the procedure call "=" which
compares blurgs, you use the record. Inside the body of the package,
you qualify the object with the .value field and you then get the
"=" which compares the pointers themselves. The client of this
package of course can not get to this function.
.
next prev parent reply other threads:[~1990-08-02 3:34 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 [this message]
1990-08-02 17:46 ` David Kassover
1990-08-03 16:01 ` David Erickson
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