How far will Stan go to consider "harmful:" to great (fractal) lengths, as usual.
I had intended to call this month's sermon "Ambiguity Considered Harmful," but delving back into the documentary highlights of our fair trade [1] I decided that the ConsideredHarmful<T> template had been overly specialized, nay, rampantly instantiated beyond reasonable reuse. The titular range of <T> officially starts with Dijkstra's "Go to statement considered harmful" (Letter to ACM Communications, March 1968), which in the received CS historiography is reckoned to have sparked the "structured-programming paradigm shift." (Alas, "Shifts Happen," according to Kuhn's bumper sticker and, to prolong the wordplay, the shifts seem to hit the fan just as we have gained fluent command under the old dispensation.)
Less structured, less dogmatic practitioners, such as Dennis Ritchie, pointed [sic] to the inevitable, unavoidable machine-level branching intructions. And, ignoring Dijkstra and his bosom pal Jahweh [2], the dangerous pastemic go to heresy retained a place in the Algol68 canon, and is still with us unto death in stretched Basics (click on GOTO) and C/C++ (goto) as a brave optional, economic gateway to the naughty silicon. (I recall when the papers warned us kids of the dangers of directly observing a solar eclipse, my mother said "If eclipses are that dangerous, why are they allowed?")
Cowardly correct Java bans (also known as "strongly pre-deprecates" [3]) the "goto," but blesses the labeled case/switch/continue/break constructs a sort of weasel cop out that pisseth off the 100%-pure "gotoless." Of course, mere 100% purity is the passé minimum in these PC days. A recent IBM PR seems to be claiming a purer-than-thou Java, reminding me of those "super-virgin" olive oil labels. Among the predicates that admit of no gradations (rather "unique," slightly "pregnant," damn-near "ISO-compliant") my favorite is the rare, reflexive, mathematical "poristic." (Buy a bigger dictionary, you mean swine the English version of Greek poristikos has been around since 1704.) A poristic equation has either no solution or an infinite number of solutions, thus rendering a potentially determinate problem indeterminate. Or vice versa?
There's the related controversy over who should be allowed to explicitly split infinitives and address horrid chunks of memory. My mother's early warning was, "It's wrong to point unless you're a dog." She had in mind those hounds trained to locate the wounded gillie but Java has followed a similar etiquette. As with all language design decisions, there are pros and cons to keep the lawyers and theologians bickering. I'm often asked "If Java shuns the pointer, why is there a NullPointerException?" [4] Ah, says I, the real dog is dangerous "pointer arithmetic" and idle dereferencing. In the fashionably related architectural domain, we meet identical debates on the mixed merits of the brick. On the bright side, suitably aimed, it can kill your brother-in-law; contrariwise, when misused, it gives you blocks of slums.
The ongoing, irreconcilable tensions between CS "calculist formalisms" and DP "meeting the payroll deadlines" have extended the ConsideredHarmful<T> template to bizarre limits. Thus, we have the popular "Dijkstra Considered Harmful," and the more deflating "Dijkstra Considered Harmless."
I suspect that related to the mysterious pathologies of "software rot" and "bit decay" [5], we may be facing a pandemic of "template tiredness." To ensure coverage in the medical journals, interviews on the "Yet Another Horror To Worry Us All Rigid" TV shows, not to mention my overdue Nobel Laureateship (Medicine/Physiology, Economics, Literature, whatever even Peace at a pinch), I dub the condition TFS (Template Fatigue Syndrome). As the Animal Rights lobby splinters into Cuddly Mammal, Reptile, Insect, Virus, DNA, Molecule, Atom, and Quark Rights factions (all attracting well meaning contributions, especially the "Hug Your Local Tapeworm" and "Don't Smash Our Protons" registered charities), I see TFS as the trigger for a unifying neo-Marxist campaign to save all overworked templates, marginalized classes, and their overloaded methods.
But what of computer-linguistic ambiguities, their causes and cures? The causes are found in the fact that all our formalisms eventually depend on the inescapable polysemies of natural language. And, as with the tango, it takes two to "ambiguate." There's me, knowing what I mean, and dumb you or the compiler acting puzzled. Sorry, I lied about the cure:
So a language need not be unambiguous, but of course when intentionally ambiguous elements are introduced it is far better to state categorically what the ambiguities are, not merely to leave them undefined, lest too many people think they are writing unambiguous programs when they are not...The use of the word 'undefined' in Section 4.3.5 is highly ambiguous, and under some interpretations it leads to undecidable questions which would make ALGOL 60 truly impossible to implement.
(From "The Remaining Troublespots in ALGOL 60," D. E. Knuth, Communications of the ACM 10, 10, 1967!)
Knuth's "highly ambiguous" suggests a metric connecting the old syntax-semantics chasm. When I ran this by Stroustrup, Bjarne's reaction was delightfully comforting: "Definitely, but I'm sure C++ is much more ambiguous than Algol60 we have made some progress since 1960!" o
Notes
[1] The "fair trade" idiom, applied to the computer-world's sprawling machinations, supplies your RDA of oxymoron and irony.
[2] "Go to, let us go down and confound their language." (Genesis 11:7)
[3] Although the Java comment tag is @deprecated, some authors fall into a common misspelling trap: "We apologize in advance if we've left in any JDK 1.0.2 methods that have been depreciated." (G. Lewis, S. Barber, and E. Siegel. Programming with Java IDL, John Wiley & Sons Inc., NY, 1998).
[4] Ken Arnold and James Gosling. The Java Programming Language (Addison-Wesley, Reading, MA, 1996), pp. 109, 297.
[5] "A hypothetical disease the existence of which has been deduced from the observation that unused programs or features will stop working after sufficient time has passed, even if nothing has changed."' (Eric Raymond and Guy L. Steele, Jr. The New Hacker's Dictionary, MIT Press, Cambridge, MA., 1991)
Stan Kelly-Bootle has been computing on and off since 1953 when he graduated from Cambridge University in Pure Mathematics and hacked on EDSAC I (the first true stored-program computer). He is a contributing editor for UNIX Review/Performance Computing, and a Jolt Judge for Software Development Magazine. His many books include 680x0 Programming by Example, Mastering Turbo C, Lern Yerself Scouse, The Devil's DP Dictionary, The Computer Contradictionary, and Unix Complete. Under his nom-de-folk, Stan Kelly, his songs have been recorded by Cilla Black, Judy Collins, the Dubliners, and himself. Stan welcomes email via skb@crl.com and his website http://www.crl.com/~skb/.