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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY 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!news4.google.com!out03a.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!xs4all!peer.news.zetnet.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Generic Collection Date: Wed, 16 May 2007 07:05:21 +0100 Organization: Pushface Message-ID: 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> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1179295521 10786 62.49.19.209 (16 May 2007 06:05:21 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Wed, 16 May 2007 06:05:21 +0000 (UTC) Cancel-Lock: sha1:CAWYOdRo5j0fuwgMM/jS98YzXt4= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (darwin) Xref: g2news1.google.com comp.lang.ada:15809 Date: 2007-05-16T07:05:21+01:00 List-Id: "Randy Brukardt" writes: > "Simon Wright" wrote in message > news:m2tzuh0yz9.fsf@mac.com... > .... >> If your implementation guidelines say that everything should be tagged >> 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). > > Not to speak for others, but there are a lot of reasons: > > (1) Most complex types need to be controlled in order to properly manage > their memory. Making them visibly tagged thus has no overhead. > > (2) Maximum flexibility: allowing future clients the ability to extend the > type without modifying the base type likely reduces future maintence (can't > break something that you don't change). I don't care much for or about > inheritance, but extension is a big win. > > (3) Tagged types "work right" in Ada: "=" composes properly, user-defined > operations are used in generics (not true for untagged types, where the > predefined ones "reimerge"), parameter passing is consistent; > 'Access can be used in the implementation without forcing users to declare > everything in sight aliased, you can use prefix calls on the objects, and > there may be more that I've forgotten. > > Note that none of these have anything to do with classwide programming, > dynamic dispatching, or inheritance, or in fact the tag itself. (3) was an > important enough issue that we actually considered adding an "aliased" type > to the Amendment which would provide those benefits without requiring a tag. > But in the end it was considered to be not enough of an improvement. > > Conclusion: (almost) all new ADTs in Ada should be visibly tagged and > possibly visibly derived from Controlled. Thanks for that. Those are all reasonable reasons (possible exception of (2); application ADTs tend not to have 'clients', I'd have thought, in the sense that you'd want to support unforeseen extensions? And I can probably break something in strange ways by bad overridings. Framework ADTs, on the other hand, are of course there to be extended). It's a shame that untagged types don't "work right" in Ada :-)