From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Overring function and its returned type
Date: Sat, 10 Nov 2012 03:35:17 +0100
Date: 2012-11-10T03:35:17+01:00 [thread overview]
Message-ID: <op.wnjdg3vfule2fv@cardamome> (raw)
In-Reply-To: op.wni7mghiule2fv@cardamome
Le Sat, 10 Nov 2012 01:28:54 +0100, Yannick Duchêne (Hibou57)
<yannick_duchene@yahoo.fr> a écrit:
> What's nice with the second attempt, is that it works
It works, but it's unsafe on the long‑run: if there are, one of the
preconditions of the inherited `F` must be reported to the other `F`, and
the same with postconditions, except you have to report them all. This is
too risky, as something may be forgotten and the language does not help
here. Even more risky if maintenance occurs on the inherited `F` in an
ancestors type, and some predicates are changed, or worst predicates added
while there were none.
Even if annoying, the only safe way is really the initial one, that is to
just have one `F`, the inherited one overrided, with an added
postcondition and an explicit checked type conversion at call places
(which may be removed in the future if ever a day Ada starts to supports
this).
--
“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
next prev parent reply other threads:[~2012-11-16 9:27 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) [this message]
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