comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Overring function and its returned type
Date: Sun, 11 Nov 2012 02:02:09 +0100
Date: 2012-11-11T02:02:09+01:00	[thread overview]
Message-ID: <op.wnk3tvh4ule2fv@cardamome> (raw)
In-Reply-To: k7l195$525$1@munin.nbi.dk

Le Sat, 10 Nov 2012 08:55:11 +0100, Randy Brukardt <randy@rrsoftware.com>  
a écrit:
> I'd strongly suggest to use different names for different types in  
> examples,
> otherwise you'll confuse everyone (and yourself). Just because you can  
> use
> the same name in the real code (and might want to in unusual  
> circumstances)
> is no good reason to make examples that confuse the heck out of everyone.

Though it was clear, since there was package prefixes. Hope every one who  
has read it understood it the way it was to be.

> Since overriding requires subtype conformance (among other things,  
> requiring
> the same subtype on all non-controlling parameters and results), and
> R2'Class /= R'Class (and this isn't a controlling result), no overriding  
> is possible.

That's how it is actually, yes.

> There are good reasons for these restrictions (mostly
> implementation-oriented).

Not convinced at all, as I gave an Ada interpretation of this, using a  
postcondition and a type conversion, which can be checked to be valid: if  
you replace the postcondition by a proper returned result type, the  
postcondition is statically checked and not needed any more, and the same  
for the type conversion. I also explained why one could expect Ada to  
obviously support it. I don't believe they are implementation issue here,  
except may be AdaCore or their clients not being at all interested in this  
kind of constructs (I name AdaCore, as there seems to be the near only  
ones implicitly referred to, when talking about compiler implementation,  
and good reason for integration of Ada features).

Dmitry's idea of a more general application of the same principle is nice,  
but may indeed present more issues. I gave one example issue, but I'm  
thinking about another even with simple `in` mode parameters. I still  
believe his idea should be feasible too and good for Ada (and to be as  
much sounds).

> I'm sure there exist (very limited) cases where it might make sense to  
> relax
> subtype conformance, but there would need to be a strong justification  
> for
> the significant added complication in the language rules and  
> implementation.
> I'm pretty certain that an example using types T and R isn't it.
>
> In any case, Ada 2012 is finished (with possibility of some editorial
> corrections in the final edition, but nothing substansive). If we were  
> going
> to fix anything in it, it would be the handful of bad bugs that have been
> identified, surely nothing involving features that are unchanged in Ada  
> 2012
> (which is the case with overriding, modulo wording bugs).

Yes, I understand it's far too late for Ada 2012. I will wait and send a  
proposal to the Ada‑Comment list a future day (I believe not before some   
months), … this will leave enough years to figure the case in deeper  
details.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University



      reply	other threads:[~2012-11-11  1:02 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
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) [this message]
replies disabled

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