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 2002:a24:8645:: with SMTP id u66-v6mr5879840itd.48.1522893938571; Wed, 04 Apr 2018 19:05:38 -0700 (PDT) X-Received: by 2002:a9d:29d2:: with SMTP id g18-v6mr1150685otd.5.1522893938368; Wed, 04 Apr 2018 19:05:38 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer02.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!u184-v6no6972739ita.0!news-out.google.com!15-v6ni1411itg.0!nntp.google.com!u184-v6no6972737ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 4 Apr 2018 19:05:38 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=87.116.176.31; posting-account=z-xFXQkAAABpEOAnT3LViyFXc8dmoW_p NNTP-Posting-Host: 87.116.176.31 References: <1b44444f-c1b3-414e-84fb-8798961487c3@googlegroups.com> <62ee0aac-49da-4925-b9aa-a16695b3fc45@googlegroups.com> <9879872e-c18a-4667-afe5-41ce0f54559f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <17b6d5b9-5909-4f0c-ab25-9b3cf4fd0450@googlegroups.com> Subject: Re: Interesting article on ARG work From: Bojan Bozovic Injection-Date: Thu, 05 Apr 2018 02:05:38 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 5114 X-Received-Body-CRC: 3652045914 Xref: reader02.eternal-september.org comp.lang.ada:51337 Date: 2018-04-04T19:05:38-07:00 List-Id: On Thursday, April 5, 2018 at 12:30:46 AM UTC+2, Randy Brukardt wrote: > "Dan'l Miller" wrote in message > news:9879872e-c18a-4667-afe5-41ce0f54559f@googlegroups.com... > >On Tuesday, April 3, 2018 at 5:33:47 PM UTC-5, Randy Brukardt wrote: > >> I'm not sure what your idea is. The pragma Assert exists already, what is > >> it > >> that you can't do with it that you need? > ... > >> "Bojan Bozovic" wrote in message > >> > Pragma assert(condition,message); > >> > Construct > >> > Assertion name is condition with message; > > > >Randy, despite your humor in the original posting, I think that he is > >(seriously) proposing ... > > I presumed he was serious, I just didn't understand what he was proposing... > > >...that assertions optionally be named so that the named condition and > >message pair is defined in one place and then utilized at the (numerous) > >places where the assertion appears, so that the condition & message do > >not vary due to the drift of time, forgetfulness, and whim of different > >programmers. ... > > Humm, I suppose that could have been it. Or it could be that that is > something you want... > > There is a much more general proposal for Ada 2020 called "ghost code" - a > silly name for code and declarations intended only to be used by assertions. > (The idea being that if it is marked and enforced as such, it can be removed > when the Assertion_Policy is Ignore.) > > Using that (which may or may not make it into Ada 2020 -- we haven't yet > discussed it at a meeting), one could use a ghost function for this purpose: > > function My_Assertion (...) return Boolean is > (if Condition then raise Assertion_Error with Message else True) > with Ghost; > > pragma Assert (My_Assertion (...)); > > (Note: The "..." here is any objects that Condition needs to be evaluated.) > > This works now (without the "ghost") and is more general in that one can > pass parameters if needed which would be a problem with the syntax proposed. > > >... there is no MetaAda that declares all language principles (preferably > > in code that compiler vendors would take as input when writing a > >compiler, instead of taking in English prose). "Everything shall be > >able to be named; that name shall be utilizable to assure uniformity at > >each point of usage to the named declaration." would be one of those > >statements in MetaAda, most likely stated in something resembling a > >language isomorphic to symbolic logic instead of quick-&-dirty English > >prose here. > > I suspect it would be a huge job to get consensus on such MetaAda rules. > While I tend to agree with your rule, it's clear that the Ada 95 designers > did not. In particular, anonymous access types have various capabilities not > available to their named counterparts (going back to Ada 95 anonymous access > parameters). This has gotten worse with each new version. I've spent some > time complaining about that, but there is only so much that any one person > can do. > > Randy. Ah I was victim of April the 1st joke! I wasn't joking though. My proposal was to add assertions in general to Ada, as something in the core language, like exceptions are, or tasks, which would function just as "ghost code" you had in mind when pragma assertion_policy (check); is used. Maybe not use assertion keyword but use functions with ghost? I really can't say which approach wold work best, from the point of function, readability and conciseness. That is for ARG to decide.