comp.lang.ada
 help / color / mirror / Atom feed
From: slos <new.stephane.los@gmail.com>
Subject: Re: Polymorphism
Date: Thu, 7 May 2015 01:34:33 -0700 (PDT)
Date: 2015-05-07T01:34:33-07:00	[thread overview]
Message-ID: <0aa1e297-7d67-4ae5-819b-e4c6ece1d9f1@googlegroups.com> (raw)
In-Reply-To: <5hbl45anxasb.1jn73i00zgy2i.dlg@40tude.net>

Le jeudi 7 mai 2015 09:41:55 UTC+2, Dmitry A. Kazakov a écrit :
> On Wed, 6 May 2015 16:05:28 -0700 (PDT), slos wrote:
> 
> > Please consider the following simple case :
> > 
> > package Object is
> [...]    
> > end Circle;
> > 
> > I'd like function Object.Area to stay private but the compiler doesn't see
> > it like that and complains if I try to move it in the private part.
> > 
> > In other words, I'd like to not expose internals to clients of the package.
> > 
> > Any hint to achieve that ?
> 
> If you privately override anything for something that is publicly
> dynamically polymorphic [~tagged], then that is not any private because you
> can [and must] be able to call the overriding body.
> 
> The Ada's types model is that Circle.Instance has the function Area anyway.
> It is either implemented per inheritance of the parent's type
> implementation (if exists) or by providing a new body per overriding. Thus
> moving overriding into private changes nothing.
> 
> I don't know why it is not allowed. Moreover, it probably would make sense
> to move all declarations of overriding into private or even further into
> the package body because the fact of overriding is mere an implementation
> detail, since the primitive subroutine is there anyway no matter what.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Thank you Dmitry for your answer.

BR,
Stéphane

  reply	other threads:[~2015-05-07  8:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 23:05 Polymorphism slos
2015-05-07  7:28 ` Polymorphism Simon Wright
2015-05-07  8:32   ` Polymorphism slos
2015-05-07  7:41 ` Polymorphism Dmitry A. Kazakov
2015-05-07  8:34   ` slos [this message]
2015-05-07 19:09   ` Polymorphism Randy Brukardt
2015-05-11 22:05     ` Polymorphism slos
2015-05-12  1:29       ` Polymorphism Randy Brukardt
2015-05-14 21:34         ` Polymorphism slos
  -- strict thread matches above, loose matches on Subject: below --
1996-11-25  0:00 polymorphism W. Wesley Groleau (Wes)
replies disabled

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