From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!kluge!scs!mackey From: mackey@scs.fiu.edu Newsgroups: comp.lang.ada Subject: Re: limited private types, "=" operator Message-ID: <1073@kluge.fiu.edu> Date: 2 Aug 90 03:34:14 GMT References: <1152@cs.nps.navy.mil> Sender: news@kluge.fiu.edu Organization: FIU/SCS List-Id: 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. .