comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Access types as parameters
Date: Sun, 16 Aug 2009 12:52:53 +0300
Date: 2009-08-16T12:52:53+03:00	[thread overview]
Message-ID: <4a87d705$0$24771$4f793bc4@news.tdc.fi> (raw)
In-Reply-To: <to4ka60rl4x2$.15gwfumff16b1.dlg@40tude.net>

Dmitry A. Kazakov wrote:
> On Sat, 15 Aug 2009 22:19:41 +0300, Niklas Holsti wrote:
> 
>> Dmitry A. Kazakov wrote:
>>> On Fri, 14 Aug 2009 19:03:52 +0300, Niklas Holsti wrote:
>>>
>>>> Of course not, only the point (within the class) of the implementation 
>>>> of the currently executing, (possibly) inherited operation (the caller) 
>>>> is determined. The actual type, as you well know, is any type in 
>>>> T'Class, although it is written "T" in the operation profile.
>>> No, the actual type is T, just because the operation declaration tells so.
>> This seems to be the origin of our disagreement. You want to view the 
>> object as of type T, although at run-time it may be a T-view of an 
>> object of a derived type S. This means that you cannot redispatch. But 
>> this does not entitle you to call redispatching "bad" in general.
> 
> Ada does not allow other cases, I mean dispatching while preserving a
> class-wide view on the object. What comes in mind:
> 
> 1. procedure Foo (X : T'Class) is
>    begin
>        if X in S'Class then
>          Bar (X); -- Now "dispatch" again
>        elsif X in Q'Class then
>          Baz (X); -- "dispatch" again
> 
> This is a form of re-dispatch since the tag of X is analyzed twice.

I don't see how this relates to our subject. Yes, that code looks at the 
tag of X. Are you saying that any inspection of the tag of an object is 
"bad design", except for the case of "basic" dispatching?

Although I sometimes do it, I don't much like to inspect tags, as in Foo 
above, because it couples the logic of a class-wide operation to the 
existence and properties of certain explicitly named sub-classes, which 
is fragile. But a redispatching call is not fragile in this way.

> Re-dispatch is a hack. What do you do is
> semantically not inheritance but overriding with an instance of a generic
> body, or some class-wide body. I think this is the key issue. 

I'm sorry, I don't understand why it is "semantically not inheritance". 
If this is again the "type error" issue, I still don't agree with you. 
Your other arguments use terms and concepts that are too vague (for me) 
to be argued about, so I don't see how we can progress usefully. Thanks 
for the discussion.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  reply	other threads:[~2009-08-16  9:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17  8:39 Access types as parameters Rick
2009-07-17 15:03 ` Adam Beneschan
2009-07-17 16:28   ` Hibou57 (Yannick Duchêne)
2009-07-17 23:25     ` rickduley
2009-07-18  1:03       ` Randy Brukardt
2009-07-19 22:57         ` rickduley
2009-07-20  0:10           ` John B. Matthews
2009-07-20  8:13           ` Dmitry A. Kazakov
2009-07-21  0:34           ` Randy Brukardt
2009-07-21 14:34           ` Adam Beneschan
2009-07-23  2:11             ` Stephen Leake
2009-08-11 23:41               ` Randy Brukardt
2009-08-12  2:22                 ` Stephen Leake
2009-08-13  1:06                   ` Randy Brukardt
2009-08-13  8:34                     ` Niklas Holsti
2009-08-13  9:15                       ` Dmitry A. Kazakov
2009-08-13 20:13                         ` Niklas Holsti
2009-08-13 21:07                           ` Dmitry A. Kazakov
2009-08-14  9:27                             ` Niklas Holsti
2009-08-14 10:36                               ` Dmitry A. Kazakov
2009-08-14 16:03                                 ` Niklas Holsti
2009-08-15  9:47                                   ` Dmitry A. Kazakov
2009-08-15 19:19                                     ` Niklas Holsti
2009-08-16  8:32                                       ` Dmitry A. Kazakov
2009-08-16  9:52                                         ` Niklas Holsti [this message]
2009-08-16 12:38                                           ` Dmitry A. Kazakov
2009-08-16 13:21                                             ` Niklas Holsti
2009-08-16 17:58                                               ` Dmitry A. Kazakov
2009-08-14  4:07                       ` Randy Brukardt
2009-08-14 10:22                         ` Niklas Holsti
2009-08-18 12:22                     ` Stephen Leake
replies disabled

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