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,LOTS_OF_MONEY, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c9a5d6b3975624e1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-08 02:10:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!dialin-145-254-045-196.arcor-ip.NET!not-for-mail From: Dmitry A.Kazakov Newsgroups: comp.lang.ada Subject: Re: OO in Ada Date: Tue, 8 Oct 2002 23:18:41 +0200 Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-045-196.arcor-ip.net (145.254.45.196) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1034068254 18332929 145.254.45.196 (16 [77047]) User-Agent: KNode/0.4 Xref: archiver1.google.com comp.lang.ada:29576 Date: 2002-10-08T23:18:41+02:00 List-Id: Matthew Heaney wrote: > "SteveD" wrote in message > news:JVrn9.40015$FO4.9224@sccrnsc03... >> >> In C++ there is a hidden "this" pointer quietly hiding in the background >> that you must be very much aware of (if you're doing any serious >> programming). In Ada this is an explicit variable passed into the >> procedure. > > This is also true in Ada, wrt passing unconstrained arrays: > > procedure Op (S : String) is > > You're actually passing a descriptor on the stack, which contains info > about > the string's length and index range. So here there is "hidden" > information being passed too, not unlike an implicit this-ptr in C++. There are other examples where Ada follows this approach: protected objects and tasks. They do have prefix syntax of entry point calls and a hidden parameter: task type A is entry Do_It; end A; ... X : A; ... X.Do_It; -- X is a hidden parameter Same as with C++, this approach works no longer a subroutine has exactly one "special" parameter. For example, should we allow in Ada rendezvous with several tasks, then the prefix syntax should be replaced by explicit parameter passing: task type A; task type B; entry Do_It (X : in out A; Y : in out B); -- This is not Ada! ... X : A; Y : B; Do_It (X, Y); -- This is not Ada! -- Regards, Dmitry Kazakov www.dmitry-kazakov.de