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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5b86cfa15b273e36 X-Google-Attributes: gid103376,public From: Mats Weber Subject: Re: Protected types made of ADT's, and Passive Iterators Date: 1998/09/07 Message-ID: <35F3FBE2.5C08F967@elca-matrix.ch>#1/1 X-Deja-AN: 388715757 Content-Transfer-Encoding: 7bit References: Content-Type: text/plain; charset=us-ascii Organization: ELCA Matrix SA Mime-Version: 1.0 Reply-To: Mats.Weber@elca-matrix.ch Newsgroups: comp.lang.ada Date: 1998-09-07T00:00:00+00:00 List-Id: John Woodruff wrote: > I can make a generic package that encapsulates a protected instance of > List in a fairly straightforward way: > BUT the base list ADT provided a passive iterator, and I'd like to offer > that capability to the clients of my protected ADT as well. This comes from Ada 95's failure to recognize generics as operations of a type. You cannot declare generic task entries or generic protected operations. The only way around the problem is to have a semaphore protecting the data in your list, but there is no easy way of encapsulating your data into a task safe construct (task or protected type). I have discussed this issue in detail in my thesis . I have some code doing what you want (implement an ADT and its protected form with the same specification) for AVL trees. Mail me if you are interested.