comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Generic procedures and their parameters
Date: Thu, 7 Sep 2006 22:35:44 -0500
Date: 2006-09-07T22:35:44-05:00	[thread overview]
Message-ID: <dbGdnW_HQKomeZ3YnZ2dnUVZ_vydnZ2d@megapath.net> (raw)
In-Reply-To: w0vh1ugsvkj1$.2fnx5mt0tplm$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:w0vh1ugsvkj1$.2fnx5mt0tplm$.dlg@40tude.net...
...
> The reverse is a different story. It is a pity that Ada does not have
> attributes to get the index and element types from the array type
> (container type). The next step would be getting "<" from the element
type,
> which would eliminate a need to have Sort generic.

That doesn't really work. "<" is what controls how the items are sorted, and
it is common to want to sort the same type in multiple ways. If you have
employee records, you might want to sort them both on Social Security
numbers and on date of employment, for example. Two generic instantiations
work fine for that, but there isn't any way to have two "<" with different
behaviors.

We had this discussion when looking at the possibility of having a sorting
interface. It just doesn't work well, because there can only be a single
implementation. (That is a problem with any scheme based on inheritance.)
That's why I view interfaces less as types and more as properties that are
either present or absent on any individual specific type.

                            Randy.





  parent reply	other threads:[~2006-09-08  3:35 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06  8:51 Generic procedures and their parameters Maciej Sobczak
2006-09-06  9:43 ` Dmitry A. Kazakov
2006-09-06 12:36   ` Maciej Sobczak
2006-09-06 13:11     ` Robert A Duff
2006-09-06 14:14       ` Maciej Sobczak
2006-09-06 15:09         ` Dmitry A. Kazakov
2006-09-06 16:35           ` Georg Bauhaus
2006-09-07  7:32             ` Dmitry A. Kazakov
2006-09-07  6:48               ` Georg Bauhaus
2006-09-07 10:19                 ` Dmitry A. Kazakov
2006-09-08  9:11           ` Maciej Sobczak
2006-09-08 10:19             ` Dmitry A. Kazakov
2006-09-09 14:49         ` Robert A Duff
2006-09-09 15:34           ` Dmitry A. Kazakov
2006-09-09 23:26           ` Jeffrey R. Carter
2006-09-10 11:49             ` Robert A Duff
2006-09-10 19:43               ` Jeffrey R. Carter
2006-09-06 13:02   ` Robert A Duff
2006-09-06 14:09     ` Dmitry A. Kazakov
2006-09-08  3:35   ` Randy Brukardt [this message]
2006-09-08  7:21     ` Dmitry A. Kazakov
2006-09-09  1:29       ` Randy Brukardt
2006-09-09  7:14         ` Dmitry A. Kazakov
2006-09-09 14:32         ` Robert A Duff
2006-09-06 12:56 ` Robert A Duff
2006-09-07  2:47 ` Steve
2006-09-07  7:47   ` 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