Newsgroups: comp.lang.misc Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!mit-eddie!xn.ll.mit.edu!xn!olson From: olson@lear.juliet.ll.mit.edu ( Steve Olson) Subject: Re: Dynamic typing (part 3) In-Reply-To: brian@comp.vuw.ac.nz's message of Thu, 11 Apr 1991 05:34:40 GMT Message-ID: Sender: usenet@xn.ll.mit.edu Organization: M.I.T. Lincoln Lab - Group 43 References: <1707@optima.cs.arizona.edu> <1991Apr11.053440.13401@comp.vuw.ac.nz> Date: 12 Apr 91 01:25:07 In article <1991Apr11.053440.13401@comp.vuw.ac.nz> brian@comp.vuw.ac.nz (Brian Boutel) writes: Let us suppose that we apply a function f to a list in which not all elements have the same type, and let us suppose further that by some stroke of luck all the elements of the list "understand" something with ^^^^^^^^^^^^^^ the name f, so in mapping f through the list there is no exception or failure, and we get a new list. What useful operations can we then perform on the result list? We know nothing about its members, except ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ that they all can all be the result of applying a function called f to something or other, which is not very helpful. Thats ridiculous. Your argument assumes a bad design. No language outlaws stupidity. Do you believe that Lisp programmers go around making up lists of completely random elements just to make things challanging? Consider f=differentiate-symbolic-expression, f=print (the result being the screen spaced used), f=insert-in-symbol-table, f=eval, f=window-system-operation, f=describe-object, f=size-of, f=database-query-pattern-match, .... Even if these values can tell you their own types, you can't write code to deal with all possibilities unless you know in advance what types can occur, in which case you can use a statically typed language, declaring a type which is a discriminated union of the possible types in the list. Of course you can use a statically typed language. The question is how much programmer resources (usually more) vs. how much machine resources (usually less) will the static solution consume? The choice depends on the application. Any problem solution can be programmed in a statically typed language, if the programmer is prepared to *design* the program before writing it. Any problem solution can be programmed in a statically typed language, period. So? Are you trying to imply that using a dynamically typed language somehow prevents one from designing? I would be far more confident trusting my life/safety/money to such a program than to some piece of hackery written in a language where "expressive power" is more important than solid engineering principle. Dynamic typing implies programs are a "piece of hackery"? Expressive power is somehow incompatable with solid engineering principle? Many (most?) large complex programs written in statically typed languages have little bits of roll-your-own dynamic typing in them. This is a prime source of "hackery". Screw up one of those explicit type tags and there is no end to the troubles you face. --brian - Steve Olson MIT Lincoln Laboratory olson@juliet.ll.mit.edu