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,86a457a80a9f4412 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!out03b.usenetserver.com!news.usenetserver.com!in04.usenetserver.com!news.usenetserver.com!news.mixmin.net!news.germany.com!news.belwue.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Generic Collection 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: <1178652593.006083.173150@l77g2000hsb.googlegroups.com> <1178658022.9164.17.camel@kartoffel> <1178661586.585164.191690@e51g2000hsg.googlegroups.com> <1178722277.733981.6200@l77g2000hsb.googlegroups.com> <1178727131.9164.38.camel@kartoffel> <1178736886.994385.37140@y80g2000hsf.googlegroups.com> <1178837285.391940.192010@e65g2000hsc.googlegroups.com> <17ls9n89vi0vh.n8gfdmvo4lv2$.dlg@40tude.net> Date: Sun, 13 May 2007 14:11:34 +0200 Message-ID: <1ofi9bjj92trh$.fb494dfpp99h.dlg@40tude.net> NNTP-Posting-Date: 13 May 2007 14:11:19 CEST NNTP-Posting-Host: c3551ee9.newsspool3.arcor-online.net X-Trace: DXC=N9bCD0;F@\n<6cDJZfMd_cMcF=Q^Z^V3h4Fo<]lROoRaFl8W>\BH3Yb3[793>I;A?eDNcfSJ;bb[eIRnRBaCd On Sun, 13 May 2007 12:00:58 +0100, Simon Wright wrote: > "Dmitry A. Kazakov" 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