comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Generic Collection
Date: Sun, 13 May 2007 14:11:34 +0200
Date: 2007-05-13T14:11:19+02:00	[thread overview]
Message-ID: <1ofi9bjj92trh$.fb494dfpp99h.dlg@40tude.net> (raw)
In-Reply-To: m2tzuh0yz9.fsf@mac.com

On Sun, 13 May 2007 12:00:58 +0100, Simon Wright wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
>>> I would probably end up with a package for each, with appropriate Add
>>> operations.
>>> 
>>> with Tuples;
>>> package Tables is
>>>   type Table is private;
>>>   procedure Add (To : in out Table; Item : Tuples.Tuple);
>>
>> + some other set-theoretic operations on the containers.
>>
>> You meant
>>
>>    procedure Add (To : in out Table; Item : Tuples.Tuple'Class);
>>
>> of course.
> 
> Did I? Not if Tuple isn't (visibly) tagged. Why would I make it
> tagged?

No, the package in question does not define Tuple. That means that Add will
not be a primitive operation of. Consequently Add is declared to work with
any Tuple, per design. To me it is class-wide. This is independent on
whether Tuple is tagged or not. After all one can derive from non-tagged
types.

> (I don't see anything in the application use cases so far (!)
> to say it should be).

Yes, but that is the problem with the whole idea. However, what about
function "=" (Left, Right : Tuple) return Boolean?

> If your implementation guidelines say that everything should be tagged

Probably yes, I am not certain about this issue. But not in the present
Ada, which has tagging overhead and no multiple dispatch.

BTW, this is why everything should better be "tagged" (in the sense of
having T'Class), just to be relieved of making such choices. A comparable
case is generics. Any type can potentially be an actual for "type T(<>) is
limited private;" So, any type is in the generic class "(<>) limited
private." Why 'Class should be discriminated?

> I'd have to ask why? (I don't believe that programming-language
> inheritance is necessarily a good way of implementing application area
> specialization/generalization).

That could be, but so far there is no great alternative mechanisms for
that. Other types of polymorphism are supported by generics and
overloading. Neither of them really shines.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2007-05-13 12:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 19:29 Generic Collection andrew
2007-05-08 21:00 ` Georg Bauhaus
2007-05-08 21:59   ` andrew
2007-05-09 14:51     ` andrew
2007-05-09 16:12       ` Georg Bauhaus
2007-05-09 18:54         ` andrew
2007-05-10 19:31           ` Simon Wright
2007-05-10 22:48             ` andrew
2007-05-11  8:10               ` Georg Bauhaus
2007-05-11 20:41                 ` andrew
2007-05-11 21:28                   ` Georg Bauhaus
2007-05-11 21:55                     ` andrew
2007-05-12  7:18               ` Simon Wright
2007-05-12  7:52                 ` Dmitry A. Kazakov
2007-05-13 11:00                   ` Simon Wright
2007-05-13 12:11                     ` Dmitry A. Kazakov [this message]
2007-05-16  0:27                     ` Randy Brukardt
2007-05-16  6:05                       ` Simon Wright
2007-05-16  7:17                         ` Untagged types don't work right - was: " Grein, Christoph (Fa. ESG)
2007-05-16 13:27                       ` Benjamin Place
2007-05-14 17:09                 ` andrew
2007-05-14 20:00                   ` Simon Wright
replies disabled

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