Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!slxsys!ibmpcug!mantis!mathew From: mathew@mantis.co.uk (mathew) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 31,497) Message-ID: Date: 26 Apr 91 12:54:05 GMT References: <1991Apr24.212350.27855@pa.dec.com> Organization: Mantis Consultants, Cambridge. UK. Lines: 58 wall@pa.dec.com (David Wall) writes: > David Gudeman writes, of the claim that static typing leads to less > complexity: > That doesn't make any sense. How can it lead to less complexity and > fewer bugs when the implementer has to explicitely handle details > instead of letting them be handled by the language? Does it lead to > less complexity and fewer bugs when implementers handle array bounds > checking without language help? What about checking for dereferencing > a null pointer? Whenever you leave such things up to the implementer > you are providing opportunities for careless bugs. > > Since when does static typing preclude runtime checks? He didn't claim that it did. Someone said "It's less complicated to let the programmer handle dynamic typing rather than the implementor". He said "Does it lead to less complication to let the programmer handle array bounds checking rather than the implementor?" The expected answer was "No", as you rightly point out; the question was asked in order to show up a flaw in the original statement. To reiterate: In general, it is less complicated to use implementor-provided features than to have to implement them yourself. It is simply not true that it is easier, less complicated or safer to write your own dynamic typing system than it is to use someone else's debugged system. > The Modula-2 I use checks for range errors, following nil pointers, > even following bad but non-nil pointers. Yes, but if we were to use the static typing enthusiasts' arguments, we should be writing a language which doesn't have pointers. That way you don't have to do time-consuming pointer-checking tests at run time, and you don't run the risk of having a pointer error occur during program execution. [ Replace "pointer" with "type" in the above paragraph and you have exactly their argument. ] > Moreover, the optimizer is good enough to get rid of most of these > checks, when they are provably redundant. Right. Which is what the dynamic type-checking people are suggesting: give the programmer a CHOICE. And if you can remove the dynamic typing at compile time then do so. mathew [ With subtitles for the hard of thinking ] -- If you're a John Foxx fan, please mail me!