From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.203.98 with SMTP id e62mr1442947yho.56.1419265348965; Mon, 22 Dec 2014 08:22:28 -0800 (PST) X-Received: by 10.140.18.173 with SMTP id 42mr34601qgf.9.1419265348949; Mon, 22 Dec 2014 08:22:28 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!dc16no1180832qab.1!news-out.google.com!r1ni76qat.1!nntp.google.com!dc16no1180826qab.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 22 Dec 2014 08:22:28 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=86.207.39.172; posting-account=ku4DIwoAAACRt0A2H-srh5aOk_YodLAH NNTP-Posting-Host: 86.207.39.172 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2430252d-52a1-4609-acef-684864e6ca0c@googlegroups.com> Subject: {Pre,Post}conditions and side effects From: =?ISO-8859-1?Q?Jean_Fran=E7ois_Martinez?= Injection-Date: Mon, 22 Dec 2014 16:22:28 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2308 X-Received-Body-CRC: 1312355844 Xref: news.eternal-september.org comp.lang.ada:24191 Date: 2014-12-22T08:22:28-08:00 List-Id: First time I read about Pre-Post conditions in Ada 2012 I felt some disconf= ort about functions invoked in pre/post conditions being allowed to have si= de effects. Tus it is possible to have programs that work when checks are = enabled and break when they are disabled that because the side effets "make= them work". I don't like "solutions" like "the compiler will allow you t= o soot yourself in the foot so be careful". That is C not Ada Perhaps it would have been a good idea to have a No_Side_Effects aspect and= only functions labelled with this pragma would be allowed in pre/post cond= itions. Such functions would not be able to modify global variables and wo= uld be restricted to invoking only functions/procedures marked with this as= pect. This is somewhat akin with the restrictions for packages marked wit= h elaboration pragmas or with pragmas realated to distributed system annex.= In both a package may only with a "lower or equal" package. First problem I see is that I/O functions have side effect so when debuggin= g No_Side_Effects_functions it would impossible to use the good-old method = of inseting Puts in the code. SEcond and biggest problem is that it is too late. Jean Fran=E7ois Martinez