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,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!feeder2-1.proxad.net!news18-e.free.fr!not-for-mail Date: Thu, 09 Sep 2004 21:58:04 +0200 From: Lionel Draghi User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.7.2) Gecko/20040820 Debian/1.7.2-4 X-Accept-Language: en-us, it MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request References: <49dc98cf.0408110556.18ae7df@posting.google.com> <6F2Yc.848$8d1.621@newsread2.news.pas.earthlink.net> <413e2fbd$0$30586$626a14ce@news.free.fr> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4140b5cc$0$17701$626a14ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 09 Sep 2004 21:58:04 MEST NNTP-Posting-Host: 82.64.200.194 X-Trace: 1094759884 news18-e.free.fr 17701 82.64.200.194:37242 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:3546 Date: 2004-09-09T21:58:04+02:00 List-Id: Kevin Cline wrote: ... > I code test-first, and the amount of test code is relatively > independent of the language. OK, because in test-first you write typical use-cases narrowed to the tested component. Tested features are the same whatever is the language. ... > The first version leaves me wondering if the comment is correct. > The second version leaves me wondering if it sometimes throws > Constraint_Error. There's no way to verify that A always returns a > value from 1 to 10 or to verify that B never throws Constraint_Error > without inspecting the function body. I was not discussing about code correctness (althrough the typed version correctness is easier to proof with static analisys tools). The big difference is that the typed version will raise the default obvious as soon as possible, the other not. To reach the same behaviour without typing, you need to do more work. > I'm also wondering what happens when you write Random_Index + > Random_Index ? > Or Random_Index * Random_Index ? Yet another advantage of typing: you wonder about problems that also exist without typing I was not aware of this advantage :-) >>On the other hand, in the A version, I need to check the return value on >>each call. > That's silly. In my simple example, yes. It's much simpler to put some assertion in the code. But once more, there is more code to write without typing. > You have to trust functions to satisfy their > postconditions. I trust the code generated by the compiler to check an assertion or a range, I trust a formal tool that certifies to me that returned value will always be in range, but I don't trust a comment. > Even in Ada relatively few post-conditions can be > handled by type checks. But whatever is the proportion, why would you renonce to this advantage? Typing has no cost, no drawback, only advantages. So, why should we discuss on what typing can't do? Anyway, I enter in this thread because of the claim that typing has much less value than test-first. I still wait for any illustration of this claim. (and I feel that I will wait for a long time) -- Lionel Draghi