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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e276c1ed16429c03 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" Newsgroups: comp.lang.ada Subject: Re: Ada is getting more popular! Date: Sat, 30 Oct 2010 02:01:46 +0200 Message-ID: References: <5086cc5e-cd51-4222-a977-06bdb4fb3430@u10g2000yqk.googlegroups.com> <14fkqzngmbae6.zhgzct559yc.dlg@40tude.net> <8732ea65-1c69-4160-9792-698c5a2e8615@g13g2000yqj.googlegroups.com> <4cc60705$0$23764$14726298@news.sunsite.dk> <4cc6753c$0$23756$14726298@news.sunsite.dk> <4cc71e08$0$23758$14726298@news.sunsite.dk> <4cc87d7a$0$23755$14726298@news.sunsite.dk> <4cc912e1$0$23761$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Trace: individual.net EKIpRzfWRYkuCIIkoUaqAQ6cpulXZF1yxU8qov+6DurmsEt17C Cancel-Lock: sha1:u7XGF4jZw5MmVTjw1pQY3UdG1UM= User-Agent: Opera Mail/10.62 (Win32) Xref: g2news2.google.com comp.lang.ada:15918 Date: 2010-10-30T02:01:46+02:00 List-Id: On Fri, 29 Oct 2010 21:56:22 +0200, Yannick Duch=C3=AAne (Hibou57) wrote: > I would enjoy to learn more about what's wrong with inheritance (I kno= w > this cannot model every thing of real life, but here the area is more > restricted) and as much about classification without inheritance (I > understand classification does not implies inheritance, but I would li= ke > to understand how and why inheritance should be avoided). Just having inheritance is not really a problem. Basically you get inher= itance with each Ada subtype you derive from another, because the new subtype i= nherits the operation from its parent subtype: type Saturated_Integer is new Natural; Thus, inheritance is very hard to avoid in Ada. Now suppose: function "+" (Left, Right : Saturated_Integer) return Saturated_Int= eger is begin return Saturated_Integer (Saturated_Integer'Base (Left) + Saturated_Integer'Base (Right)); exception when Constraint_Error =3D> return Saturated_Integer'Last; end; So, in the object oriented view the above already uses overriding and vi= ew conversion. The problems start with the dynamic properties, where the operations on = the types can not be resolved statically anymore, because these are very har= d to prove for correctness. They may even call subroutines which are compl= etely out of the scope of the unit you're calling it from. And if you don't want (or are not allowed, because the Software Programm= er's Manual says so) to use class-wide programming, then there's usually no p= oint in using inheritance at all. ;) Well, I better shut up now, Jean-Pierre is the expert on that, I am just= a user. ;) Vinzent. -- = There is no signature.