Hello (again) world!
We’ve returned to blogging with a fun and thought provoking article by our Guest Blogger Dave Gosselin. Dave is a C++ Engineer and keeps his own blog: Software Engineer’s Field Guide to Bugs. In this piece, Dave has taken the time to ponder the definition of a scripting language. We hope you’ll enjoy and are very interested in hearing your thoughts and ideas as well!
What is a scripting language?
In my last job we used Python to implement a nontrivial project for a customer. The project included about five developers working out of a single CVS repository. I found Python an easy language to learn and use for writing components; however, I was frustrated at integration time because of Python’s weak typing–and caused trouble because my fellow engineers inevitably varied the interface only slightly (“Oh, that second argument is now a dictionary instead of a list–d’oh”).
Anyhow, that led to me singing the praises of Python the same way that someone would sing the praises of a lover who ditched them unceremoniously. I blamed Python because “it was a scripting language and all scripting languages are weakly typed and thus just plain weak.”
One of my colleagues, more wise than I, then posed the question: what is a scripting language? He challenged me to ponder if my beloved C++ was indeed a scripting language and if all languages are scripting languages and some have a compiler and some don’t. Somehow I believed that a compiler made languages better because it could do compile-time type checking, optimization, dead-code path checks, and limited static analysis–I guess those are bad things to this guy.
Since that time I’ve become a right-tool-for-the-job type and have learned that different languages suit different problem domains. But the question of what a scripting language is has remained in my mind as open until very recently.
Wikipedia has some round-a-bout definitions for a scripting language. For example,
“A scripting language or script language is a programming language that supports the writing of scripts, programs written for a special runtime environment that can interpret and automate the execution of tasks which could alternatively be executed one-by-one by a human operator.” (http://en.wikipedia.org/wiki/Scripting_language).
This is true for languages like bash, python, perl, and so on but is not limited to these; you could do the same in C on *nix, for example, by repeatedly invoking the system() call (however tedious that may be).
I have an alternate definition of a scripting language that I’d like to float for the open-minded:
A scripting language is any language L where a program written in L can modify itself using L directly while the program is executing.
My first example is Lisp and a program written in Lisp can modify itself using Lisp while it is running. Interestingly enough, this means that most assembly languages (or machine languages, you pick) are also scripting languages. They merely script the execution of the CPU. Compiled languages, then, may be defined simply: they are not scripting languages.
Looking for more information like this? Check out other blog posts on this topic by clicking on the button below:
Thanks to Michael Himbeault for the use of his photo.