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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ffef1fd08e45df0c X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: using put procedure with a generic package Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <151bc418-a6e4-47ef-ab7f-5b93a3cedb58@r66g2000hsg.googlegroups.com> Date: Thu, 8 May 2008 09:24:53 +0200 Message-ID: <90esaqageqi6.1n0vkyp57ejgf.dlg@40tude.net> NNTP-Posting-Date: 08 May 2008 09:24:50 CEST NNTP-Posting-Host: 18d30150.newsspool1.arcor-online.net X-Trace: DXC=:1l7741CjcQ=>bdbdS?M0Yic==]BZ:af^4Fo<]lROoRQ<`=YMgDjhgR\]A3Fo^W:]Y[6LHn;2LCV^7enW;^6ZC`TIXm65S@:3>_@70PkE34?IS X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:5748 Date: 2008-05-08T09:24:50+02:00 List-Id: On Wed, 7 May 2008 21:48:47 -0700 (PDT), ophir.geffen@gmail.com wrote: > The problem is that the package needs to know how to handle most non- > limited types like Integer, String, Client, Plane, Book, Document, ... String is an indefinite type. > Is there a better way to write the package and/or a more correct way > to declare it when using it? That depends on what your queue package is. If it is a queue of items with 1. no requirements of the representation of in the queue 2. value copy semantics of insertion and retrieval then I would use one of the following three variants: 1. Queue internally implemented by an array of elements 2. Queue implemented as a user-defined storage pool 3. Queue implemented as a user-defined stream For any of these variants you just don't need any Put procedure. Copying is predefined private type (cases 1 and 2). Stream attributes are also predefined. The choice between 1 and 2 depends on whether Item is definite: type Item is private; -- 1 would be OK type Item (<>) is private; -- This is for the variant 2 -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de