comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Access types as parameters
Date: Thu, 13 Aug 2009 23:13:39 +0300
Date: 2009-08-13T23:13:39+03:00	[thread overview]
Message-ID: <4a847400$0$26304$4f793bc4@news.tdc.fi> (raw)
In-Reply-To: <n2kl87gos0rq$.1wa06mhken7oc$.dlg@40tude.net>

Dmitry A. Kazakov wrote:
> On Thu, 13 Aug 2009 11:34:20 +0300, Niklas Holsti wrote:
> 
>> Randy Brukardt wrote:
>>
>>> You almost never want redispatching
>> That's interesting as my experience is the opposite: Most of the calls 
>> between primitive methods in my code use redispatching.
> 
> Shudder...

Also an interesting reaction.

> I consider re-dispatch is an indication of a language / design problem,
> because it is a hidden type error. An argument goes as follows. Once you
> have dispatched to some type T, the corresponding controlling parameter is
> of this type. Let we converted it to a class. If now it dispatches again to
> T, then that was just wasting time, if it dispatches to S /= T then it is a
> type error.

To me that is a very abstract and formalistic argument that is easily 
weaker than the practical benefits (providing sensible but overridable 
default behaviour while avoding code duplication) that make me use 
redispatching. What is more, a central benefit of inheritance is that an 
object can be viewed as being of parent type T *and also* of derived 
type S, depending on the context and your needs, so I don't accept that 
redispatching "to a different type" implies a type error.

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



  reply	other threads:[~2009-08-13 20:13 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 [this message]
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
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