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: a07f3367d7,5add429c86f59001 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!feeder.news-service.com!news.astraweb.com!border5.a.newsrouter.astraweb.com!xlned.com!feeder1.xlned.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada vs Eiffel - Ada programmer approach Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <405b5054-4c8f-4e16-9ea8-503a9b9f976e@t21g2000yqi.googlegroups.com> <4A19765C.608@obry.net> <8105b65f-4de9-4653-b43a-d55ee33f072d@k2g2000yql.googlegroups.com> <9rWSl.118630$DP1.42605@attbi_s22> <02f8bbe8-b7fa-4633-bf90-1f2b9677264c@r34g2000vba.googlegroups.com> Date: Thu, 4 Jun 2009 11:19:12 +0200 Message-ID: NNTP-Posting-Date: 04 Jun 2009 11:19:12 CEST NNTP-Posting-Host: a0e164a4.newsspool3.arcor-online.net X-Trace: DXC=fK`cP:fN;?3RadXUBHgFh3McF=Q^Z^V384Fo<]lROoR1^YC2XCjHcb91obUf_i?@_7DNcfSJ;bb[5FCTGGVUmh?4LK[5LiR>kg2G^iWHdo30>? X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6220 Date: 2009-06-04T11:19:12+02:00 List-Id: On Thu, 4 Jun 2009 02:02:01 -0700 (PDT), Ludovic Brenta wrote: > Yannick Duch�ne wrote on comp.lang.ada: >> On 26 mai, 20:21, "Jeffrey R. Carter" >> >> wrote: >>> I agree. I never create tagged types, except to obtain finalization. I think the >>> widespread acceptance of programming by extension, even by People Who Should >>> Know Better, represents the triumph of those who emphasize ease of writing over >>> ease of reading. >> >> So how do you do extentions ? >> Did you never need this ? > > The question is not really "how do you do extension", but "why do you > do extension". In order to reuse the interface and some implementations of these operations. > In my experience, composition is usually a more correct > choice. It is not a choice because composition inherits to the record type interface and provides an implementation of the interface (e.g. member access, assignment of the record etc). In a more general case composition inherits to the container interface. So the question is why do you inherit to the container rather than to number, task, file, employee etc? > There are, of course, some cases where extension is good but > my inheritance hierarchies are usually very shallow. Extension /= inheritance. It is a case of inheritance. There is nothing that could replace inheritance, because there is no way to "invent" a new type out of nothing. Whatever type algebra operation you take, it always uses some building blocks (the arguments) from which you inherit the interface of the result. There is nothing really useful beyond inheritance. Even if you use the minimal possible type-algebraic operation in Ada: type T (<>) is limited private; you still inherit a lot of things. For example attributes, like X'Address. > For example, if you want some record type T to become controlled, you > don't have to make extend Ada.Finalization.Controlled; you don't even > have to make T tagged. All types are "controlled" in Ada, in the sense that they are properly finalized upon destruction. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de