Perl6 vs Java vs Python, or, Java sucks! and the NIH Fallacy

scrottie on 2005-02-07T20:36:29

I recently wrote a book that deals with doing things (using features and ideas) in Perl invented and popularized by other languages. People react to that statement in fascinating ways - "what? Why would you want to do something in Perl that another language does? Perl is better so using things from Java and Python is pointless" they say.

I'm going to show first why quoted (paragraphased, actually) statement is dumb and then secondarily why it's a fallacy. Let's pretend a character called Mike said this for the sake of simplicity. "NIH" is "Not Invented Here" - a phrase coined by The Mythical Man Month to describe the tendency of one software team to write their own libraries, kernels, tools, etc rather than using perfectly good prewritten ones from other teams or departments. I'm transposing NIH to apply to ideas as well as code.

1. Mike's message is that there's no point doing anything unless you're known for doing it. However, Perl did not spring whole from the ground. It started off as an improvement over mixing sed and awk - in other words, it was a bastardization of a few existing languages. Sure, it was better than sed and awk, but the ideas were clearly derived. Under Mike's logic, Perl shouldn't have stolen from sed and awk because, before Perl was written, sed and awk were better known for doing what sed and awk do than Perl was. Under Mike's logic, Perl should stay out of sed and awk's sandbox and gone off and created a universe unto itself (as Perl eventually has done, slowly over time). Perl shouldn't have used any stepping stones, in other words. Mike's message is rooted in ego and is entirely impractical and by virtue of being impractical is un-Perl-like, IMO.

2. Mike's message contains a fallacy. Lets suppose for the sake of argument that Java is an amalgamation of parts, and lets also assume that Java "sucks" (that is, it's undesireable to use, for whatever undefined reason). Given that the whole is undesireable, it does not follow that every part of Java is undesireable. Java has threads and so does Perl. Java has package scoped variables and so does Perl. And so on. If you believed that every part of Java was tained by being in Java then you'd also have to accept that Perl was tained. The truth is, languages like Java and Python, while not necessarily pleasent for a Perl programmer to use, contain many very nice ideas that have vast potential application in Perl.

Perl has never stopped gobbling up langauges. Perl even stole from COBOL (I *think* that's where formats came from). Perl apparently invented typeglobs and "contexts" (function overloading on return type, often at run-time!), two features of curious merit, and Perl 6 is retiring one of those. Taken from the approach of a zealot, Perl's purity should be maintained, barriers should be errected between Perl and other languages, and distinctions should be maximized, but let me tell you, the situation is far more interesting and fun from the prespective of a historian. Not only aren't these barriers useful, but they aren't needed - or desired.

Perl 3 stole vigerously. Perl 4 stole vigerously. Perl 5 stole vigerously. Perl 6 continues to steal vigerously. In the Free Software/Open Source camp, taking code and ideas from other projects is a Good Thing (tm). It's what make Free Software great. Every project is better off because they have access to every other project. "The rising tide lifts all ships". Perl just happens to steal from Java, Python, Logo, Lisp, and numerous other languages - directly or indirectly. In some cases, the features were merely popularized by these languages (Java has invented nothing, really, but popularized a good deal). These features won't make Perl suck - they'll make fewer people have to use amalgamations of ideas where the amalgamation is incomplete, restrictive, or otherwise unpleasent to use.

Don't stick your head in a hole and pretend nothing is going on anywhere in the world except in the Perl camp and that Perl created itself. There's a whole big world, and it's really interesting, and you can take bits of it home with you.

An aside: Creativity and progress aren't obvious extensions of well known things (like Microsoft patents), nor are they spontanious formations of independent and self contained universes. It lies somewhere in the middle. This is no slur against creativity. You may be creative building with Lincoln Logs and you may try to implement life in code. Because Perl combined things creatively does not mean Perl isn't a creative work or is somehow less. Java was engineered, but it was engineered intentionally to be a mix of a few well understood things. SNOBOL is a universe unto itself that sprung from the ground whole.

Comments? Write an essay that walks through your deductive process and reaches a different conclusion or expounds on a point, then email me at scott@slowass.net with a link to the article, and I'll edit this text to link to it.