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,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Structured exception information References: <1168885771.30643.20.camel@localhost> <1168891576.30643.39.camel@localhost> <5NKdnTv2UZfVZTbYnZ2dnUVZ_vipnZ2d@megapath.net> <38z8yk9z1uxn$.1r6qpevwu2i7c.dlg@40tude.net> <1lpy2h06scx34.1i2k4dlbg0nfy.dlg@40tude.net> <%xErh.228837$aJ.94458@attbi_s21> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1169233066 12.201.97.213 (Fri, 19 Jan 2007 18:57:46 GMT) NNTP-Posting-Date: Fri, 19 Jan 2007 18:57:46 GMT Organization: AT&T ASP.att.net Date: Fri, 19 Jan 2007 18:57:46 GMT Xref: g2news2.google.com comp.lang.ada:8339 Date: 2007-01-19T18:57:46+00:00 List-Id: Dmitry A. Kazakov wrote: > > OK, what about an alternative. Let's forget about preconditions, let's call > it *constraint*. This is what Ada has since its beginning. What about > allowing more generous constraint expressions put on the subtypes? It could > have the desired effect, IMO. The "precondition" could be a constraint on > the subtype of an in-parameter. The "postcondition" could be one on the > subtype of an out-parameter. We could allow ad-hoc subtypes in subprogram > signatures, for lazy guys... This is a good point. Ada's subtypes have always been a form of dynamic precondition. I've always thought it better to write Length : in Natural than Length : in Integer --#pre Length >= 0 So it would be nice if this concept could be extended to essentially handle dynamic preconditions. Any suggestions how to apply this to, say (DS : in out Data_Structure; Index : in Positive) --#pre Index in 1 .. Size (DS); ?