comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada wikibook help needed (O-O)
Date: Sun, 23 Apr 2017 19:03:44 +0200
Date: 2017-04-23T19:03:44+02:00	[thread overview]
Message-ID: <odimpe$1sh6$1@gioia.aioe.org> (raw)
In-Reply-To: odijed$c2v$1@dont-email.me

On 2017-04-23 18:09, G.B. wrote:
> On 23.04.17 12:52, Dmitry A. Kazakov wrote:
>> On 2017-04-23 12:22, G.B. wrote:
>>
>>> The page goes to some length to explain static dispatching
>>> vs. dynamic dispatching, but fails to introduce "dispatching"
>>> first, as a term, or to reference some suitable definition.
>>
>> It does in the section "Polymorphism, class-wide programming and
>> dynamic dispatching". Dispatching is a mechanism of polymorphic call
>> implementation for the case of dynamic polymorphism.
>>
>>> Then,
>>>
>>>   "A conversion to the class-wide type makes [components] visible
>>> again."
>>>
>>> Is "visible" correct?
>>
>> Why not?
>
> Converting to T'Class does not make any components of T'Class visible
> if they are private, at the point in source of that conversion.
> In this sense, it is unfortunate that "view" in "view conversion"
> might trigger an association with "visibility" in the reader's mind.

Yes, you are right, conversion to T'Class does not add anything it can 
only subtract something.

But, maybe, direct visibility was meant? Say, T is declared in P and S 
is declared in Q:

package P is
    type T is tagged ...;
    procedure Foo (X : T);
end P;

package Q is
    type S is new P.T with ...;
end Q;

If I have "use P" and no "use Q" then conversion to T'Class will make 
Foo applicable in non-prefix notation.

> Yet, what is meant is that after view conversion, the object can
> be seen as of any type in T'Class, whichever type it might be.

No, that requires another conversion. To see X as S from T'Class you 
must convert it to S. T'Class is a substitute for the intersection of 
all types [values of].

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2017-04-23 17:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 10:22 Ada wikibook help needed (O-O) G.B.
2017-04-23 10:52 ` Dmitry A. Kazakov
2017-04-23 16:09   ` G.B.
2017-04-23 17:03     ` Dmitry A. Kazakov [this message]
2017-04-24  5:13       ` G.B.
2017-04-24  7:55         ` Dmitry A. Kazakov
2017-04-24 12:34     ` Jacob Sparre Andersen
2017-04-24 22:06   ` Randy Brukardt
2017-04-24 22:03 ` Randy Brukardt
2017-06-30 13:54 ` Norman Worth
2017-06-30 15:34   ` AdaMagica
replies disabled

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