Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!think.com!linus!linus!mingus!john From: john@mingus.mitre.org (John D. Burger) Newsgroups: comp.lang.misc Subject: Re: The powerlessness of Lisp Message-ID: <1991Mar26.172536.12178@linus.mitre.org> Date: 26 Mar 91 17:25:36 GMT Sender: news@linus.mitre.org (News Service) Organization: The MITRE Corporation, Bedford, MA 01730 Lines: 90 Nntp-Posting-Host: mingus.mitre.org We seem to have a vocabulary problem regarding program speed. Regarding some Lisp programs that I described, brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: You said it was ``fast enough,'' so obviously its run time is not particularly significant. I claim that for most programs the opposite is true, and dynamic typing can greatly increase the turnaround time during development. You can measure the accuracy of this claim by dividing the CPU time of test runs by the total programming time, for various programs. I still don't understand this. The run time is significant. Period. The program is not too slow. If I could have implemented it in a statically typed language, it would almost certainly run faster. But I contend that development time in that case would have been nearly infinite. As far as your measurements go, I haven't run any such experiments, and neither has anyone else. But you know that. Again, in my experience, which is real, development in Lisp and other dynamically-typed languages is faster than the alternatives. Point blank, have you ever developed any significant program in Lisp? Concerning the pluses of Lisp, Dan continues: A ``REAL source level debugger'' and incremental compilation are functions of the environment. Fine. Then the distribution of languages with these features should be independent of whether those languages have dynamic typing. This doesn't appear to be the case, however. Heterogeneous collections don't seem to be used in real applications ---or do you have a counterexample? Several examples have already been given by others. Frankly, I don't see how "real applications" (whatever that means) can do without heterogeneity. How would you represent logical formulae? A predicate has a name and a collection of arguments: some are variables, some are constants, some are function terms. A logical connective has a set of arguments, some of which are other logical connectives, and some of which are relational expressions. How about a drawing program, in which you need to represent sets of polygons, splines, bitmaps, and so on? Even simpler, how about a calculator, doing arithmetic with integers, reals, ratios and complex numbers? The world is full of heterogeneous collections. I think people who don't see any use in representing them are simply making a virtue of necessity. Concerning your "byte-copying" example, you don't appear to actually know Common Lisp. Additionally, your example seems to hinge on the fact that C represents characters as 1-byte integers. But then again, C represents practically everything that way. The point is that someone who wants to use dynamic typing in C can easily do so. I believe we agree here. The point is that lots of people feel they have to implement dynamic typing in C. Doesn't that tell you something? But anyway, we agree in the sense that, yes, dynamic typing can be implemented in C, but ORTHOGONALLY TO THE EXISTING TYPE SYSTEM. I can put a TYPE field in each of my structures, and then dispatch on its value at runtime, but I can't declare at compile time that a particular structure will have a particular TYPE value. The NIH Class Library for C++ is a good example of this. In order to get runtime typing, they've had to implement a SECOND type system on top of the first one, and never the twain shall meet. So what is gained by including dynamic typing in the language (hence compiler), rather than in a standard library? The obvious disadvantage is that most existing dynamically typed languages *force* you to use dynamic typing, and don't let you declare types even when you know what they will be. This just isn't the case. Lisp (and most other dynamically-typed languages) let you declare types all you want, and most Lisp compilers pay attention and produce significantly smaller/faster code. The situation you describe is exactly what's wrong with YOUR way of doing dynamic typing, i.e. as an add on. The compiler can't know about it, and therefore can't optimize it. -- John Burger john@mitre.org "You ever think about .signature files? I mean, do we really need them?" - alt.andy.rooney