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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a270a1fc28d4f812 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-22 06:37:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!news-x2.support.nl!psinet-eu-nl!psiuk-p4!uknet!psiuk-p3!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: OOD in Ada? Date: Fri, 21 Jun 2002 13:22:47 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: References: <3d135676$0$8511$cc9e4d1f@news.dial.pipex.com> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 1024680167 23181 136.170.200.133 (21 Jun 2002 17:22:47 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 21 Jun 2002 17:22:47 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:26600 Date: 2002-06-21T17:22:47+00:00 List-Id: "David Crocker" wrote in message news:3d135676$0$8511$cc9e4d1f@news.dial.pipex.com... > I know that Ada95 tries to support O-O development, but from my perspective > as an OO developer but Ada novice, it appears to me that any attempt to > implement a large OO design in Ada will run into the following problems: > > 1. The infamous "withing" problem (i.e. it is not possible to declare 2 > classes A and B, each in its own package, such that A has a method taking a > paremeter of type "access B", and B has a method with a parameter of type > "access A"); and > I'm not sure that this is somehow or other essential to OO Programming. Perhaps you just need to consider another way of doing it rather than try to force an idiom from another language onto Ada. If you really need to do that, you could probably do some version of deriving A and B from some lower level type(s) that declares an access type to the underlying type(s)'Class - then A and B can with the base types and get the access types they need. A solution does exist - I just don't think I'm convinced that you really need to do that and that failure to find a way means you can't do large OO designs in Ada. If you absolutely insist it is essential, try this: package Base_Class is type Base_Type is tagged private ; type Base_Ptr is access all Base_Type'Class ; -- etc... private type Base_Type is tagged null record ; end Base_Class ; package Base_Class.A is type A is new Base_Type with private ; private type A is new Base_Type with record B_Ptr : Base_Ptr := null ; -- Can point to any B without "with" end record ; end Base_Class.A ; package Base_Class.B is type B is new Base_Type with private ; private type B is new Base_Type with record A_Ptr : Base_Ptr := null ; end record; end Base_Class.B ; Iyou're familiar enough with Ada and OOP, you should be able to figure it out from here... (And no, they don't both need to derive from the same base type and they don't need to be child packages of the base class.) > 2. The lack of a "dot" notation (or anything similar) for calling a member > method, making the code hard to read and hard to determine where dynamic > binding may be taking place. > This is just a syntax thing - one debated here a number of times in the past. I don't find it essential or hard to read or anything like that. But then, I'm used to looking at it from "Method (Object)" perspective rather than "Object->Method" form. Whatever you are used to is going to make the other way seem "Bad". If you decide to simply Get Over It and work with the syntax that exists, you'll find it is no more confusing or difficult than what you are used to. It certainly won't stop you from implementing any large OO designs and if you take the language as a whole, I think you'll find you gain lots of benefits from using it that outweigh whatever downsides there may be to having to learn & use something that is "Different". (Think of the benefits you get from things like tasks, protected types, generics, etc. Isn't that worth a little change in the syntax you are used to?) MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com