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,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!xlned.com!feeder7.xlned.com!news2.euro.net!newsfeed.x-privat.org!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Wed, 9 Feb 2011 21:23:36 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <36212a7b-deab-45d9-ac45-aa29cd90c7bc@o18g2000prh.googlegroups.com> <4d51a7bb$0$19486$882e7ee2@usenet-news.net> <4d52b489$0$19486$882e7ee2@usenet-news.net> <9a8njlwvey1p.1a96yvvgdf6yu.dlg@40tude.net> <4d52c5e5$0$19486$882e7ee2@usenet-news.net> <720b7e8f-1ae2-4b3b-851e-12b08b3c99e0@r4g2000prm.googlegroups.com> <4d52dd97$0$18057$882e7ee2@usenet-news.net> <9a8f406d-05ca-4bf3-8487-918d4e0dd634@o18g2000prh.googlegroups.com> <4d52ee47$0$18057$882e7ee2@usenet-news.net> <4d5306a0$0$18057$882e7ee2@usenet-news.net> <76c123ab-7425-44d8-b26d-b2b41a9aa42b@o7g2000prn.googlegroups.com> <4d5310ab$0$18057$882e7ee2@usenet-news.net> <9bff52ca-6213-41da-8fa4-3a4cdd8086d3@y36g2000pra.googlegroups.com> <4d5315c8$0$18057$882e7ee2@usenet-news.net> <4d531a54$0$18057$882e7ee2@usenet-news.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1297308220 28405 69.95.181.76 (10 Feb 2011 03:23:40 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 10 Feb 2011 03:23:40 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news1.google.com comp.lang.ada:17205 Date: 2011-02-09T21:23:36-06:00 List-Id: "Hyman Rosen" wrote in message news:4d531a54$0$18057$882e7ee2@usenet-news.net... > On 2/9/2011 5:38 PM, Vinzent Hoefler wrote: >> Hyman Rosen wrote: >> >>> Excuse me, but I really, truly do need to know what my >>> subprogram is going to do. People have been telling me >>> about "contracts" and "requirements" and "proofs of >>> correctness" and that Ada is good for stuff. So I have >>> this subprogram and I'd like to know what it will do >>> for different values of its parameter so I'll know if >>> I can use it or not. >> >> You can't use it. It will raise Storage_Error for some >> values. > > Hmm. You know, this makes me think that before I can call > any subprogram, I'm going to need to examine its body to > see how many nested subprogram calls it makes, as well as > those bodies, and so on. And even then, is there anything > that tells me exactly when I will get Storage_Error? How > can I reason about the behavior of any Ada program? You can't. Ada says that *anything* can raise Storage_Error; reading the body will do you no good at all. You might be able to guess by reading the body, but the language definition says that "null;" can raise Storage_Error. Thus there is no reason to read the body to worry about Storage_Error. That's one of the reasons why I said "Ada is not good enough". If you actually care about Storage_Error (and surely it is relevant sometimes), the language has to give you the tools to reason about it. In addition, the contract (or even the comments) for your routine says nothing about the expected input or output values. A "good" language would simply not allow you to write such a contract, you would have to say *something*. (Unfortunately, experience with Java seems to suggest that people choose expediency over correctness every time, so there are a lot of useless contracts that are written. A "great" language would have to enforce "no useless contracts", too. It's should be obvious that this is a hard problem.) Randy.