Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!otter.hpl.hp.com!otter!sfk From: sfk@otter.hpl.hp.com (Steve Knight) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 3) Message-ID: <2400035@otter.hpl.hp.com> Date: 19 Mar 91 15:15:41 GMT References: <602@optima.cs.arizona.edu> Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 46 In response to a claim (or observation) made by David Gudeman that "dynamically typed languages are generally half to a tenth the size of programs in statically typed languages" Dan Bernstein reasonably writes back. ] I don't believe you. Give an example. Of course, this gets us into the foolish realms of anecdotes and virility tests. However, just because a challenge is foolish... Well, perhaps it is sufficient to say that this exchange reminded me of an amusing incident a couple of years ago between myself and a friend of mine. (Who shall remain nameless; unless you're reading this, Tim.) After a rather boring stint at work, Tim into my office with a broad smile on his face -- evidently having completed an exceptionally useless task successfully. "Watch this," he said, and proceeded to demonstrate the capabilities of a simple program he'd prepared earlier while watching the C compiler dither over a small pile of files. This program read a file of syllables and printed out "passwords" composed from three random syllables. It was vaguely entertaining in that sort of Friday afternoon-going-on-evening, let's-out-for-a-pizza-later kind of way. Tim then showed me the source code. Now Tim, I should explain, makes no pretension of being a great C hacker (well, not then) but had composed the program in a very workman-like way. However, at several pages of code it seemed rather lengthy to me. I leaned over my workstation and said, "Oh, it would have been a bit easier in Pop11" and proceeded to for a few moments. (Pop11 is the dynamically typed language of this tale, by the way.) What emerged was the following few lines ... define program(); ;;; build a list of syllables lvars syllables = 'syllables'.discin.incharline.pdtolist; repeat 3 times syllables.oneof.pr ;;; print a syllable 3 times endrepeat; nl( 1 ); ;;; throw 1 new line enddefine; I ran it a couple of times. No problem -- too simple for an error. Even for me. Suddenly, I felt two hands close around my windpipe. As everything went black, I heard, "You <****>, it took me two hours to debug that <******- ******>." Of course, being choked to death by irate C programmers is only one of the many hazards of using a dynamically typed language ...