From: Dmitry A.Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: OO in Ada
Date: Tue, 8 Oct 2002 23:18:41 +0200
Date: 2002-10-08T23:18:41+02:00 [thread overview]
Message-ID: <anu7et$hff81$3@ID-77047.news.dfncis.de> (raw)
In-Reply-To: uq35eldljbpcc@corp.supernews.com
Matthew Heaney wrote:
> "SteveD" <nospam_steved94@attbi.com> 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
next prev parent reply other threads:[~2002-10-08 21:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-04 2:14 OO in Ada Rick Duley
2002-10-04 2:55 ` Jim Rogers
2002-10-04 17:35 ` Hyman Rosen
2002-10-05 0:20 ` Jim Rogers
2002-10-05 23:38 ` Dmitry A.Kazakov
2002-10-05 15:25 ` Jim Rogers
2002-10-06 21:37 ` Dmitry A.Kazakov
2002-10-06 2:18 ` Hyman Rosen
2002-10-06 3:00 ` Jim Rogers
2002-10-08 21:08 ` Gisle Sælensminde
2002-10-04 3:37 ` Chad R. Meiners
2002-10-04 5:32 ` Simon Wright
2002-10-04 6:01 ` tmoran
2002-10-04 15:05 ` Matthew Heaney
2002-10-05 2:14 ` SteveD
2002-10-05 8:54 ` Preben Randhol
2002-10-07 14:10 ` Matthew Heaney
2002-10-07 19:52 ` Jeffrey Carter
2002-10-08 21:18 ` Dmitry A.Kazakov [this message]
2002-10-08 9:53 ` John McCabe
2002-10-08 15:37 ` Matthew Heaney
2002-10-08 16:47 ` Georg Bauhaus
2002-10-08 17:48 ` Matthew Heaney
2002-10-08 17:16 ` Warren W. Gay VE3WWG
2002-10-08 17:58 ` Matthew Heaney
2002-10-09 16:59 ` Warren W. Gay VE3WWG
2002-10-08 10:21 ` Preben Randhol
-- strict thread matches above, loose matches on Subject: below --
1998-05-15 0:00 Gisle S{lensminde
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox