comp.lang.ada
 help / color / mirror / Atom feed
From: dgibson@snoopy.cis.ohio-state.edu (david scott gibson)
Subject: Re: Extending A Generic Signature Package
Date: 1997/03/21
Date: 1997-03-21T00:00:00+00:00	[thread overview]
Message-ID: <5gvgg0INNj32@snoopy.cis.ohio-state.edu> (raw)
In-Reply-To: JSA.97Mar21200655@alexandria


In article <JSA.97Mar21200655@alexandria>,
Jon S Anthony <jsa@alexandria> wrote:

>> >    declare
>> >       X : Base'Class := Get_Object;
>> >    begin
>> >       Op1(X);
>> >    end;
>> 
>> So in this case it's clear to us and the compiler what specific type
>> derived from Base Get_Object returns.
>
>No, the _specific_ type is unknown until runtime.  But, whatever it
>is, it will be in Base'Class.

Hmmm.  I was thinking of Get_Object as a constructor for a specific
derived type of Base.  Are you're suggesting some non-functional
behavior here for Get_Object to be able to return any one of several
specific derived types?

>Ah.  This is something that many people trip over: an access object
>(or "pointer") is not the same thing as an object that happens to be
>passed by reference.  Also, tagged types are not necessarily return by
>reference types (_limited_ tagged types are: see 6.5(11)).

Okay, I've primarily been using limited tagged types lately and forgot
that this rule only applied to them.  Nevertheless, I assume compilers
may return tagged types, especially big ones, by reference.  I didn't
mean to imply that objects passed by reference should be thought of as
"pointers".  Ada seems to do a good job of making the mechanism
transparent.  

Dave
--
dgibson@cis.ohio-state.edu







  reply	other threads:[~1997-03-21  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-17  0:00 Extending A Generic Signature Package david scott gibson
1997-03-18  0:00 ` Tucker Taft
1997-03-18  0:00   ` Alexander V. Konstantinou
1997-03-21  0:00     ` Geert Bosch
1997-03-21  0:00       ` Brian Rogoff
1997-03-22  0:00         ` Robert A Duff
1997-03-21  0:00 ` Jon S Anthony
1997-03-21  0:00   ` david scott gibson
1997-03-22  0:00     ` Robert A Duff
1997-03-22  0:00 ` Jon S Anthony
1997-03-21  0:00   ` david scott gibson [this message]
1997-03-22  0:00     ` Robert A Duff
1997-03-25  0:00 ` Jon S Anthony
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox