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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d89b08801f2aacae X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-29 16:27:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!deine.net!teaser.fr!enst!enst.fr!not-for-mail From: "Beard, Frank [Contractor]" Newsgroups: comp.lang.ada Subject: RE: Is strong typing worth the cost? Date: Mon, 29 Apr 2002 19:26:23 -0400 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: avanie.enst.fr 1020122822 47813 137.194.161.2 (29 Apr 2002 23:27:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 29 Apr 2002 23:27:02 +0000 (UTC) Return-Path: X-Mailer: Internet Mail Service (5.5.2650.21) Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:23240 Date: 2002-04-29T19:26:23-04:00 -----Original Message----- From: dmjones [mailto:derek@NOSPAMknosof.co.uk] >> Because then they will have to program in all the necessary >> checking to prevent erroneous results. The group that uses > Not necessarily. If I know a particular quantity will vary > between 1..5 I will define such a type. I know that I then get > this 1..5 assumption checked for me, which is useful. But would > I go to the effort of putting all those 1..5 checks in by hand? > I doubt it. But that's my point. You would by using a strong typing feature, in this case a subtype range. If you were not using strong typing, then you would have to write in checks to ensure the value was within that range. Otherwise, you get unexpected, and erred, results. >> How are you going to determine that the unprotected group >> programmed all the necessary checking? Are you going to >> have some type of code analysis software to check it out? >> This will have a huge impact on downstream maintenance. > Can back this statement up with some evidence? Not with a study that you're looking for, just practical experience (though I do remember reading articles off an on). I worked on a Fortran graphics project a number of years back. Fortran has no protection from going outside any boundaries you define (at least not back then). The data that was being plotted looked fine most of the time, when suddenly the graph would flat-line either high or low. It took days, if not weeks, to figure out where a rounding error was occurring. Someone had forgotten to explicitly declare a variable as a float, and it had defaulted to an integer. So, there was rounding error that sometimes lead to an out-of-bounds high or out-of-bounds low value. That would never have happened with Ada. For one, you would have to explicitly convert between the types, instead of continuing along in blissful ignorance. Secondly, you would have gotten an exception, with a traceback, telling you where the offending code was located. We didn't even know that with the Fortran (hours and hours of painful attempts to recreate the situation). I had a similar experience with interfacing to C code on Windows. A C DLL we interfaced with went wandering out through our code and eventually crashed the application. Fortunately, with CodeView debugging on, the traceback pointed back into the C code, where the C programmer figured out he was interrogating the data structure the was passed to him. The problem was it was an empty structure that his code was supposed to populate. For some reason, his code was trying to examine it and print the contents of one of the string values. All the strings were blank filled, so it went who knows where until it cause some type of segmentation fault and crash the application. Anyway, I'm sorry I don't have the time to try and dredge up the articles from the past, but I've been in both environments (strongly typed and loosely typed) and I never want to go back to loosely typed languages. Frank