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: 103376,585fd78267abd80c X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.post.ch!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: On pragma Precondition etc. Date: Tue, 29 Jul 2008 13:18:37 +0200 Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) Message-ID: <488efc8d$1@news.post.ch> References: <4889886d$0$18827$9b4e6d93@newsspool2.arcor-online.net> <6etsi6F8mbmbU2@mid.individual.net> NNTP-Posting-Host: 194.41.146.1 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: atlas.ip-plus.net 1217330321 17353 194.41.146.1 (29 Jul 2008 11:18:41 GMT) X-Complaints-To: abuse@ip-plus.net NNTP-Posting-Date: Tue, 29 Jul 2008 11:18:41 +0000 (UTC) User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: <6etsi6F8mbmbU2@mid.individual.net> X-Original-NNTP-Posting-Host: w03duo.pnet.ch X-Original-Trace: 29 Jul 2008 13:18:37 +0100, w03duo.pnet.ch Xref: g2news1.google.com comp.lang.ada:1371 Date: 2008-07-29T13:18:37+02:00 List-Id: Alex R. Mosteo schrieb: > Piling more suggestions: I understand the point of using pragmas by Gnat at > this stage, but if this is going to be standardized perhaps the syntax of a > declaration could be changed. For example: > > function Foo (X, Y : Something) return Whatever with > Precondition (Blah) and > Postcondition (Urgh); It too think a dedicated syntax would be best. However, I suggest to take a good look at task and protected types for guidance. Protected types already have an precondition. I know they are attached to the body and a protected type blocks until the condition becomes true. But the idea behind is still similar and so should be the syntax. Now let me think: Option 1: using when - just like protected types. function Foo ( Integer X,Y) entry when X > Y exit when Foo > X + Y return Integer; Option 2: using nicer English. function Foo ( Integer X,Y) on entry X > Y on exit Foo > X + Y return Integer; Both options would not need new keywords ;-) And how about Invariants (http://en.wikipedia.org/wiki/Class_invariant)? Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com