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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8b8748382fcfacc1 X-Google-Attributes: gid103376,public From: Ray Blaak Subject: Re: friend classes in ada95 Date: 2000/04/19 Message-ID: #1/1 X-Deja-AN: 613242196 Sender: blaak@LANGLEY References: <38F6B617.34E216A7@emw.ericsson.se> <38F887AE.8CDA24E0@acm.org> <8dc8oi$kda$1@nnrp1.deja.com> <38FD7F1A.E4906194@icn.siemens.de> X-Complaints-To: news@bctel.net X-Trace: news.bc.tac.net 956169298 209.53.149.68 (Wed, 19 Apr 2000 11:34:58 PDT) Organization: The Transcend NNTP-Posting-Date: Wed, 19 Apr 2000 11:34:58 PDT Newsgroups: comp.lang.ada Date: 2000-04-19T00:00:00+00:00 List-Id: Alfred Hilscher writes: > I would have preferred this notation too. > 1. "class type t is ..." and "t'class" would be more clear than > "type t is tagged ..." and "t'class" > 2. I have to write task type t is and not type t is concurrent > ... And "protected type t", not "type t is protected". For that matter, given a protected type, one also writes t.Foo instead of Foo(t). I know people here feel strongly about the normal procedural syntax for method calls, and it certainly helps to avoid problems, especially with defining binary operations, but having been away from Ada for a while, and using Delphi, C++, and Java, I have found I have changed my mind. I am realizing the saying obj.Method is a more natural way of expressing how I *think*. I like Delphi's way of doing OO: type TObject = class (ParentClass, Interface1, Interface2, ...) private attribute : Integer; public procedure Foo(v : Integer); end; and then the implementations look like: procedure TObject.Foo(v : Integer); begin self.attribute := v; end; I consider myself to be an experienced OO programmer, and at one time was an expert Ada programmer, and I certainly "get" Ada's way of doing OO with tagged types, but I find the syntax now for doing simple OO stuff tedious and not as clear to the reader as it should be. Multiple inheritance from interfaces should be easy. Declaring virtual methods should be easy. In Ada, the caller decides if dispatching is desired by ensuring a method call is in terms of a class wide parameter or not. I think it should be the class implementor that decides, since if the caller gets it wrong, it is a silent error. Delphi's style makes overriding and polymorphism clear in the code: type TObject = class(TBaseObject) procedure Foo; override; // required if TBaseObject.Foo is virtual procedure DispatchOnMe; virtual; end; Ada's style is the most "correct" since we have a true building block approach, but I just wish the syntax was a little better. I am spouting religious opinions to be sure, I generally like Ada very much, and its OO style is now standardized and not going to change any time soon, but I will still complain about it now and again. -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, blaak@infomatch.com The Rhythm has my soul.