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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,cae92f92d6a1d4b1 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Ada.Execution_Time Date: Mon, 20 Dec 2010 13:28:17 -0800 Organization: None to speak of Message-ID: References: <4d05e737$0$6980$9b4e6d93@newsspool4.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx03.eternal-september.org; posting-host="9nFTuw1iclElqUG5+//YDQ"; logging-data="30158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+YOG8nVbiTyQKSLUWIJ8l" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:k64XmciWIo0WDpkXgHV9U6cmNdA= sha1:IOs4Z1SdfyRpxUwxoSoXtaO9yKY= Xref: g2news2.google.com comp.lang.ada:17049 Date: 2010-12-20T13:28:17-08:00 List-Id: "Randy Brukardt" writes: > "Adam Beneschan" wrote in message > news:dfcf048b-bb6e-4993-b62a-9147bad3a6ff@j32g2000prh.googlegroups.com... > On Dec 15, 2:52 pm, Keith Thompson wrote: > ... >>> So, um, why is Assert a pragma rather than a statement? >>> >>> if Debug_Mode then >>> assert Is_Good(X); >>> end if; > ... >>Somebody on the ARG might have a more authoritative answer. My >>reading of AI95-286 is that a number of Ada compilers had already >>implemented the Assert pragma and there was a lot of code using it. >>Of course, those compilers couldn't have added "assert" as a statement >>on their own, but adding an implementation-defined pragma is OK. > > That's one reason. The other is that you can't put a statement into a > declarative part (well, you can, but you need to use a helper generic and a > helper procedure, along with an instantiation, which is insane -- although > it is not that unusual to see that done in a program). A lot of asserts fit > most naturally into the declarative part (precondition ones, for instance, > although those will be better defined separately in Ada 2012). So add an assert operator that always yields True: declare Dummy: constant Boolean := assert some_expression; -- assert operator begin assert some_other_expression; -- assert statement end; Though the use of "Assert" as an identifier in existing code is certainly an issue. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"