comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Overring function and its returned type
Date: Fri, 9 Nov 2012 11:24:57 -0800 (PST)
Date: 2012-11-09T11:24:57-08:00	[thread overview]
Message-ID: <2592ab84-d216-4a4a-bb77-ca896393aaec@googlegroups.com> (raw)
In-Reply-To: <1vej4u29b8e4z$.289wazkl31wg$.dlg@40tude.net>

On Friday, November 9, 2012 12:25:17 AM UTC-8, Dmitry A. Kazakov wrote:
> On Fri, 09 Nov 2012 08:13:23 +0100, Yannick Duchêne (Hibou57) wrote:
> 
> >            overriding
> >            function F
> >              (E : T)
> >               return R'Class -- Not overriding :-(
> >               is abstract;
> 
> What is this? "overriding" + "abstract" does not make sense.

I don't see that.  It's true that if you define an abstract type T1 with an abstract operation Op, and if you derive an abstract type T2 from T1, Op will be inherited, so it doesn't affect the semantics it you redeclare an abstract Op.  Still, I can certainly understand why a programmer would want to redeclare Op anyway, so that a person reading the package that defines T2 will see all the operations available for T2, and won't have to hunt for the definition of T1 to see what other operations might be defined for T2.  And if the programmer does redeclare Op for T2, then it's a good idea to add the "overriding" keyword to prevent accidents.

Also, it's legal to declare an abstract type derived from a non-abstract type.  In that case, you may actually want to override the non-abstract inherited operation with an abstract one.

                         -- Adam



> 
> 
> In any case it is the default. When you do nothing, you get F through
> 
> inheritance and it is abstract when the parent's F was.
> 
> 
> 
> Ada's declarations are not idempotent, in the sense that you cannot repeat
> 
> them like you could in C++. So "F ... is abstract" always
> 
> overloads/conflicts.
> 
> 
> 
> P.S. They should really have used the syntax with the keyword "overriding"
> 
> trailing behind "is" rather than preceding "function/procedure."
> 
> 
> 
> -- 
> 
> Regards,
> 
> Dmitry A. Kazakov
> 
> http://www.dmitry-kazakov.de




  parent reply	other threads:[~2012-11-09 19:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09  7:13 Overring function and its returned type Yannick Duchêne (Hibou57)
2012-11-09  7:22 ` Yannick Duchêne (Hibou57)
2012-11-09  8:24 ` Dmitry A. Kazakov
2012-11-09  9:14   ` Yannick Duchêne (Hibou57)
2012-11-09 13:11     ` Dmitry A. Kazakov
2012-11-09 21:36       ` Yannick Duchêne (Hibou57)
2012-11-09 19:24   ` Adam Beneschan [this message]
2012-11-09 19:34 ` Adam Beneschan
2012-11-09 22:00   ` J-P. Rosen
2012-11-09 22:30     ` Yannick Duchêne (Hibou57)
2012-11-09 19:57 ` sbelmont700
2012-11-09 21:10   ` Yannick Duchêne (Hibou57)
2012-11-09 21:56     ` sbelmont700
2012-11-10  0:28     ` Yannick Duchêne (Hibou57)
2012-11-10  2:35       ` Yannick Duchêne (Hibou57)
2012-11-15 15:13   ` Peter C. Chapin
2012-11-16 10:40     ` Maciej Sobczak
2012-11-16 12:39       ` Peter C. Chapin
2012-11-16 15:27         ` Maciej Sobczak
2012-11-16 17:29           ` Peter C. Chapin
2012-11-17  4:16           ` Yannick Duchêne (Hibou57)
2012-11-17 19:11             ` Robert A Duff
2012-11-18 14:53               ` AdaMagica
2012-11-19  8:41                 ` Yannick Duchêne (Hibou57)
2012-11-19 13:04                   ` AdaMagica
2012-11-19 15:19                     ` Dmitry A. Kazakov
2012-11-19 23:42                   ` Randy Brukardt
2012-11-10  7:55 ` Randy Brukardt
2012-11-11  1:02   ` Yannick Duchêne (Hibou57)
replies disabled

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