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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c944ce2ba25eeb02 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-19 13:41:04 PST Path: supernews.google.com!newsfeed.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!news.huji.ac.il!not-for-mail From: "Ehud Lamm" Newsgroups: comp.lang.ada Subject: Re: Generic Packages Date: Thu, 19 Apr 2001 23:26:25 +0300 Organization: The Hebrew University of Jerusalem Message-ID: <9bni0i$ugu$1@news.huji.ac.il> References: <9bnh7f$5di$1@news.inter.net.il> NNTP-Posting-Host: di3-92.dialin.huji.ac.il X-Trace: news.huji.ac.il 987712339 31262 132.64.13.92 (19 Apr 2001 20:32:19 GMT) X-Complaints-To: abuse@news.huji.ac.il NNTP-Posting-Date: Thu, 19 Apr 2001 20:32:19 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Xref: supernews.google.com comp.lang.ada:7017 Date: 2001-04-19T23:26:25+03:00 List-Id: First thing you have to realize is that when you want a generic unit to work ona private or limited private type, the package must somehow be told how to work with objects of the opaque type. Basically, you do this by supplying routines as generic parameters. These routines are the ones that know how to use the type (they usually come from the package that exports the time). They, in essence, provide an interface that the generic unit needs in order to work with the type. This is a restricted form of the itnerface exported by the ADT package. I usually describe this situation with the following metahpor.There is a secrect, and this secret is how to handle the abstract data type. You want to pass this secret to the generic unit. However generic units don't have ears so you can't just lean over and whisper the secret. What you do is package the secret inside a routine (a more techincal term would be "procedural abstraction") and pass the routine to the generic unit. This subject is explained very well in the Ada83 Ratioanale chapter on generic units. I highly recommend reading it (you instructor should have a copy of this chapter, and you can also find it online). Good luck with the assignment! Ehud Lamm