## Language Zealotry

From my recent post about what a computer can do, there are a number of mathematical theorems that bear it out.  One is the notion of Turing Completeness.  In essence, a computer or computing model is Turing Complete if it can be emulated by a Turing machine.  A Turing machine is a very simple model for computation which, as it turns out, is not a whole lot different from the computer I presented.

Now, there is a similar theorem about programming language equivalence, which boils down to this:

All programming languages are the same.

The proof, without rigor, goes like this: given programming languages A and B which are both Turing complete, if you can simulate a Turing machine in programming language A, then programming language A can simulate programming language B, therefore there is nothing that can be done in B that can't be done in A.  Similarly, if you can simulate a Turing machine in B, then programming language B can simulate programming language A, therefore there is nothing you can do in A that can't be done in B.

So why is it that one person may love A to such an extent that they openly disparage anyone who even suggests that B might be better?  Even some of the more widely known language designers have been very outspoken about one language or another.

The biggest contributors are familiarity, utility and applicability to the task at hand.  Some programming languages are just made to solve certain classes of problems in certain ways.  Years ago, I wrote a FORTH compiler as an independent project.  It was great fun, because FORTH is really an oddball language in a number of ways, the first of which is that it is an RPN language, the second is that it really has no syntax to speak of.  Anything that looks like syntax is actually convention imposed by a particular element of the language.

For example the FORTH word ." is used for printing.  In context, it Looks like this:
ok ." Hello, world!"
Hello world!
ok

Note that there is a space before the 'H' which is not printed.  What ." does is read from the current input (either command line or program source until it reaches a ", printing the output (this is actually a lie), but FORTH looks like '.' means print and everything in quotes gets printed.  But it doesn't.  It just looks that way.

Now, one of the languages that attracts a lot of fanatics is Scheme.  It's a nifty LISP variant that has a number of very attractive language features, including the ability for a function to return as it's value a new function that can be applied later on.  In other words, new executable code can be created at runtime by the language which is on equal footing with any other language element.  Nifty.  So how is that implemented?  Beats me (this is also a lie).  Turns out that you can do the same thing in FORTH and not only can you do it, the amount of code that makes that happen is way, way, way tiny.  Like scary tiny.

So why don't people use FORTH commonly?  Well, it turns out that FORTH is a pretty painful language to use.  Common tasks can be pretty horrible, and until you are really used to the language, it is usually harder to read than it is to write, which is bad news for long-term projects.

What I recommend is learning a wide variety of languages.  There are very few languages that are completely awful, and there is always something to learn, even if it's "don't do this".  What you will find is that over time your time to learn a new programming language gets shorter and shorter.  I'm around a day or two, depending on the language.  By that, I mean that after a day or two of reading/writing, I can pretty much author code with a manual by my side.  At this point you realize that there is even more of depth to Turing completeness: there is not a plethora of computer languages.  There is one.  All the rest are merely dialects.
Technorati Profile
Published Thursday, March 02, 2006 8:48 AM by Steve Hawley