comp.lang.ada
 help / color / mirror / Atom feed
From: marciant@earthlink.net
Subject: Re: Overriding puzzle
Date: Thu, 31 Dec 2015 08:30:22 -0800 (PST)
Date: 2015-12-31T08:30:22-08:00	[thread overview]
Message-ID: <562f3cd1-b66d-465f-aa89-7d0b7b0e5ea4@googlegroups.com> (raw)
In-Reply-To: <n61o94$nu8$1@loke.gir.dk>

On Wednesday, December 30, 2015 at 6:10:30 PM UTC-5, Randy Brukardt wrote:
> <mar...@earthlink.net> wrote in message 
> news:677...@googlegroups.com...
> > On Wednesday, December 30, 2015 at 1:24:06 PM UTC-5, 
> > gautier...@hotmail.com wrote:
> >> No, the "A'Class(o)" also makes the difference when type Custom
> >> is framed into a package:
> >
> ...
> > General note to self: tagged type operations that call other operations of 
> > the type should always(?) convert the object to its 'class so as to cause 
> > dispatching.  Not doing so is probably a defect!
> 
> Nooooo. Redispatching is best left for very limited circumstances. There's a 
> reason that Ada makes you write it explicitly!

<snipped the reason>

> In limited circumstances 
> (like the OP), it works well, but for general programming, look out!

So, you mean that it would be wrong to try to fall back on the general rule that I stated and that judgement is always necessary in each specific case.
In this case you agree that it goods well.  If the case was such that it would not work well, should the parent type have the "not-to-be-dispatched-to" subprogram be declared as class-wide?  Would you consider it a defect in the implementation of the parent type if such a subprogram was not class-wide?  Shouldn't making a primitive tagged subprogram visible mean that it is thought to be fine to expect that any internal redispatching (that may or may not be caused) would "work well"?   I know - a lot of questions.

But in summary, I'm thinking that you mean that careful case by case design is necessary. 

  parent reply	other threads:[~2015-12-31 16:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-30 14:49 Overriding puzzle gautier_niouzes
2015-12-30 15:10 ` Egil H H
2015-12-30 17:31   ` gautier_niouzes
2015-12-30 18:07   ` marciant
2015-12-30 18:24     ` gautier_niouzes
2015-12-30 21:40       ` marciant
2015-12-30 23:10         ` Randy Brukardt
2015-12-31  8:22           ` Niklas Holsti
2015-12-31  8:42             ` Dmitry A. Kazakov
2016-01-03  7:18             ` Randy Brukardt
2015-12-31 16:30           ` marciant [this message]
2015-12-30 23:13     ` Randy Brukardt
replies disabled

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