Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!noao!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 3) Message-ID: <2450@optima.cs.arizona.edu> Date: 26 Apr 91 00:19:41 GMT Sender: news@cs.arizona.edu Lines: 44 In article <1991Apr25.165342.14354@pixar.com> Mark VandeWettering writes: ]In article <1707@optima.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes: ]>...the program above does ]>not have the full generality of the mathematical or the dynamically ]>typed version. ]Well, in a language with strong typing, the function f has a particular ]type (alpha -> beta). It doesn't make sense to have a function which ]applies to more than a single type. It certainly does. I do it all the time. ]Note: I do understand the motivations for weak (you may call it dynamic if ]you like) typing. There are many distinct advantages to both side. There is a difference between weak typing and dynamic typing. Lack of understanding of this has resulted in far too much controversy, especially since the definitions have been posted. To repeat: weak typing means that the language may have undefined behavior like infinite loops or core dumps from a type error. Dynamic typing means that it is not generally possible to assign a machine representation to the values that will be returned by all syntactic expressions. You can still get strong typing in this case by including type information with the data at runtime. ]>Type inference has some nice features, but it does _not_ give you the ]>expressive power of dynamic typing. ]Hard statement to prove, and almost meaningless. Does it mean you can't ]express the same programs? In the same or fewer lines of code? On what ]kind of an example.... It means that most programs are smaller and simpler in dynamically typed languages than in statically typed languages. It is not all that hard to show this: just compare the size of all the .h files in C programs to the total size of the program. As a rough approximation, the .h files are the extra baggage caused by static typing. That is a very rough approximation though, since dynamic typing enhances reusability of code. So a lot of reduncancy in the .c files should be eliminated also. -- David Gudeman gudeman@cs.arizona.edu noao!arizona!gudeman