There are at least two excellent reasons for this huge
diversity. One is the wide use of Unix as a research and teaching
platform. The other (far more relevant for working programmers) is the
fact that matching your application design with the proper
implementation language(s) can make an immense difference in your
productivity. Therefore the Unix tradition encourages the design of
domain-specific languages (as we mentioned in Chapter7 and Chapter9) and what are now generally
called scripting languages
—those designed specifically to
glue together other applications and tools.
In truth, the term ‘scripting language’ is a
somewhat awkward one. Many of the the major languages usually so
described (Perl, Tcl, Python, etc.) have outgrown the group's
scripting origins and are now standalone general-purpose programming
languages of considerable power. The term tends to obscure strong
similarities in style with other languages that are not usually lumped
in with this group, notably Lisp and Java. The only argument for
continuing to use it is that nobody has yet invented a better
term.
Part of the reason all these can be lumped together under the
rubric of ‘scripting language’ is that they all have
pretty much the same ontogeny. Having a runtime to do interpretation
also makes it relatively easy to automate dynamic storage management.
Automating dynamic storage management almost requires using references
(opaque memory addresses that you can't do arithmetic on) rather than
passing value copies or explicit pointers around. Using references
makes runtime polymorphism and OO an easy next step.
Voila:
the modern scripting
language!
In this chapter we'll survey C and its most important
alternatives, discussing their strengths and weaknesses and the
sorts of tasks to which they are best matched. The languages
covered will be C, C++, shell, Perl, Tcl, Python, Java, and Emacs
Lisp. Each survey section will include case studies on applications
written using these languages, and references to other examples and
tutorial material. High-quality implementations of all these
languages are available in open source on the Internet.
Warning: Choice of application language is one of the archetypal
religious issues in the Internet/Unix world. People get very attached
to these tools and will sometimes defend them past all reason. If this
chapter achieves its aim, zealots of all stripes may be offended by
this chapter, but everyone else will learn from it.