comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <matsw@bluewin.ch>
Subject: Re: ANN: Simple components v 1.3
Date: Thu, 15 Jan 2004 15:01:05 +0100
Date: 2004-01-15T15:01:05+01:00	[thread overview]
Message-ID: <matsw-8893DA.15010415012004@sicinfo.epfl.ch> (raw)
In-Reply-To: 75ga001eokc2r1aijtvu9d70ck3i6j1p0m@4ax.com

In article <75ga001eokc2r1aijtvu9d70ck3i6j1p0m@4ax.com>,
 Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:

>>> This release includes generic maps (associative arrays)

>http://www.dmitry-kazakov.de/ada/components.htm

I have been working on this (generic maps) for quite a while (and a long 
time ago). What I came up with is that the generic formal key type must 
be limited private and unconstrained (<>) for the component to be 
useable in most situations.

Here is the generic formal part of my version of maps:

generic
   type Key_Type (<>) is limited private;
   type Item_Type is private;
   with function Key_Of (Item : in Item_Type) return Key_Type;
   with function "=" (X, Y : Key_Type) return Boolean is <>;
   with function "<" (X, Y : Key_Type) return Boolean is <>;
   type Count is range <>;    -- must include 0
package Bags is
   ...

The big differences is that there is no constraint on Key_Type and that 
the key is part of each item and is extracted from it with the generic 
formal function Key_Of. 

For instance, you can have Key_Type => String, with the above, which you 
cannot do with your version.



  reply	other threads:[~2004-01-15 14:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-03 17:17 ANN: Simple components v 1.3 Dmitry A. Kazakov
2004-01-14 12:06 ` Preben Randhol
2004-01-14 13:15   ` Dmitry A. Kazakov
2004-01-15 14:01     ` Mats Weber [this message]
2004-01-15 15:04       ` Dmitry A. Kazakov
2004-01-15 16:22         ` Mats Weber
2004-01-15 18:18           ` Jeffrey Carter
2004-01-16  9:49           ` Dmitry A. Kazakov
replies disabled

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