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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6cb2525ffbfe23ce X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Why both "with" and "use"? Date: 1999/02/13 Message-ID: #1/1 X-Deja-AN: 444098484 Sender: matt@mheaney.ni.net References: <36C5B28C.F32C43A4@jps.net> <7a4f85$rh1$1@remarQ.com> <7a4j3h$64e@drn.newsguy.com> NNTP-Posting-Date: Sat, 13 Feb 1999 14:46:39 PDT Newsgroups: comp.lang.ada Date: 1999-02-13T00:00:00+00:00 List-Id: bill writes: > Also, in Java a package seems to have different purpose than with Ada. In > Java a package is a collection of classes. In OO Ada, a package usually > contains one tagged type. or is this not the normal practice? A package exports a collection of entities that are "highly cohesive." As such, it often makes sense to bundle types together in the same package. For example: generic type Item_Type is private; package Stacks is type Stack_Type is limited private; procedure Push (Item : in Item_Type; On : in out Stack_Type); type Stack_Iterator is private; function Initialize (Stack : Stack_Type) return Stack_Iterator; function Get_Item (Iterator : Stack_Iterator) return Item_Type; procedure Advance (Iterator : in out Stack_Iterator); end Stacks; Here, we have an example of a stack type and its iterator type, together in one package. This is entirely natural and appropriate.