comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: using put procedure with a generic package
Date: Thu, 8 May 2008 09:24:53 +0200
Date: 2008-05-08T09:24:50+02:00	[thread overview]
Message-ID: <90esaqageqi6.1n0vkyp57ejgf.dlg@40tude.net> (raw)
In-Reply-To: f4751dc5-2909-46c3-9dc3-5883f28d8400@56g2000hsm.googlegroups.com

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



  reply	other threads:[~2008-05-08  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  3:27 using put procedure with a generic package ophir.geffen
2008-05-08  4:09 ` Jeffrey R. Carter
2008-05-08  4:48   ` ophir.geffen
2008-05-08  7:24     ` Dmitry A. Kazakov [this message]
2008-05-08 15:54     ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox