Xref: utzoo comp.lang.misc:7149 comp.object:2951 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!udel!cis.udel.edu From: carroll@cis.udel.edu (Mark Carroll) Newsgroups: comp.lang.misc,comp.object Subject: Re: Static typing: the OOP seatbelt Message-ID: <49229@nigel.ee.udel.edu> Date: 29 Mar 91 02:47:25 GMT References: <14160@life.ai.mit.edu> <1991Mar25.201620.5839@cua.cary.ibm.com> <27F11D7B.6309@tct.uucp> Sender: usenet@ee.udel.edu Followup-To: comp.lang.misc Organization: University of Delaware Lines: 60 Nntp-Posting-Host: sol.cis.udel.edu In article <27F11D7B.6309@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >According to rick@cua.cary.ibm.com.UUCP (Rick DeNatale): >>I'm actually a little bit surprised that people put so much faith in compile >>time type checking systems that they are willing to accept an implementation >>that allows type errors that escape the compiler to cause wild branches and >>other unsavory acts ... > >Please note! The C++ type system does, in fact, prevent such type >errors -- UNLESS the programmer lies to the compiler about the type of >an object. Such lies are entirely the programmers fault, and do not >reflect badly on the language. > But C++ has it's share of semantic ugliness. Consider the (now) well known problems of copy constructors. Or the fact that it requires you to use multiple inheritance in order to kludge a simulation of dynamic typing. (Sorry, I'm one of the folks who still don't believe in multiple inheritance. I've never been able to see any case in which multiple inheritance was a really good solution - except where it as basically just a kludge around a static typing system.) >>I haven't seen a strong typing system yet that doesn't require you to >>(hopefully carefully) circumvent it at times ... > >And I, in turn, have never seen an automobile in which it is not >necessary to take off the seatbelt occasionally, even when driving. >That doesn't mean that seatbelts are counterproductive. > >We've all heard the stories of people who drowned in their submerged >cars because they couldn't unfasten their seatbelts. But such >anecdotes leave unmentioned the thousands of lives that are lost in >mundane accidents, lives that could have been saved if only seatbelts >were used. Arguments against static typing are often based on similar >anecdotal evidence; such arguments are similarly bogus. A fine example of proof by analogy. And as usual, it doesn't prove anything. Static typing is NOT a seatbelt. Dynamic typing is NOT less safe than static typing. I've said the following several times, but just in case it hasn't sunk in yet: Any typing error that would be trapped in a staticly typed language can be captured in a dynamically typed languages using dataflow analysis. If the error can't be caught with dataflow, then either the program would be written differently in the static language (in which case, the same safe version could be written with the dynamic typed language), or the staticly typed language would have a kludged dynamic typer, in which case the static language would be as subject to error as the dynamic. >Chip Salzenberg at Teltronics/TCT , -- ---------------------- Mark Craig Carroll: ------------------------ ------ U of Del. Grad Student in CIS ------ EE/CIS LabStaff Hacker ------ -- Resident Wierdo @ 105 E Cleveland Ave, Newark DE - carroll@udel.edu -- ---------------------- Shalom Achshav - Peace NOW! ----------------------