Topic: Feedback:N4415 Simple contracts for C++
Author: germandiago.tests@gmail.com
Date: Fri, 17 Apr 2015 01:18:19 -0700 (PDT)
Raw View
------=_Part_738_993402910.1429258699277
Content-Type: multipart/alternative;
boundary="----=_Part_739_1108928003.1429258699277"
------=_Part_739_1108928003.1429258699277
Content-Type: text/plain; charset=UTF-8
Hello everyone,
I would like to give some feedback on the proposal.
I think the proposal is quite reasonable and in essence very similar to
Walter E. Brown's proposal N4435
Proposing Contract Attributes
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4435.pdf).
N4415 suggests to have switches for turning on-off validation, in case the
runtime does validate something.
This leaves things as an all-or-nothing feature, meaning that if you don't
check preconditions,
you will not check any. For me, it makes sense that we don't check
is_sorted + is_permutation after sorting,
but it is valuable to check for container !empty() and similar conditions.
I think there should be a way to leave cheap preconditions in code
always enabled.
The use case for this is that bugs occur. There are pre and
postconditions that are worth to be left enabled even in production
environments, saving valuable debugging time should a problem occur.
Therefore, I would suggest to augment expects and ensures with
expects_always and ensures_always (or similar) for checks
that will always be performed, not affected by the contract
switches.
Best Regards
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_739_1108928003.1429258699277
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello everyone,<div><br></div><div>I would like to give so=
me feedback on the proposal.</div><div><br></div><div>I think the proposal =
is quite reasonable and in essence very similar to Walter E. Brown's propos=
al N4435</div><div>Proposing Contract Attributes (http://www.open-std.org/j=
tc1/sc22/wg21/docs/papers/2015/n4435.pdf).</div><div><br></div><div>N4415 s=
uggests to have switches for turning on-off validation, in case the runtime=
does validate something.</div><div>This leaves things as an all-or-nothing=
feature, meaning that if you don't check preconditions,</div><div>you will=
not check any. For me, it makes sense that we don't check is_sorted + is_p=
ermutation after sorting,</div><div>but it is valuable to check for contain=
er !empty() and similar conditions.</div><div><br></div><div><br></div><div=
><div> I think there should be a way to leave cheap preconditio=
ns in code</div><div> always enabled.</div><div> Th=
e use case for this is that bugs occur. There are pre and</div><div> =
postconditions that are worth to be left enabled even in production</=
div><div> environments, saving valuable debugging time should a=
problem occur.</div><div><br></div><div> Therefore, I would su=
ggest to augment expects and ensures with</div><div> expects_al=
ways and ensures_always (or similar) for checks</div><div> that=
will always be performed, not affected by the contract</div><div> &n=
bsp;switches.</div></div><div><br></div><div><br></div><div>Best Regards</d=
iv><div><div><br></div></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_739_1108928003.1429258699277--
------=_Part_738_993402910.1429258699277--
.