It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

By James Hague
Gamasutra
August 13, 1999

Printer Friendly
Version Availabl
e

Letters to the Editor:
Write a letter
View all letters


Features

Contents

Introduction

What Are the Benefits, Exactly?

The Tale of An Abused Bandicoot

Yes, but Are You Really Serious About All This?

What Are the Benefits, Exactly?

Is Haskell — the language used in the preceding example — the holy grail of game programming? Probably not, but it's only one of a number of languages that have been the result of much research into language theory and implementation over the last twenty years. In the days of 20 MHz 80286-based machines (which you could still buy only eight years ago), heavier languages like Haskell, ML, and Scheme seemed out of reach for everyday work. Similarly, any graphics text written during the first fifteen years following the invention of the z-buffer dismissed the technique as hopelessly memory intensive. With gigahertz processors dotting the horizon, things have changed.

C and C++ are usually cited as typical high-level languages, but they also have a reputation as "systems programming languages" or "high-level assemblers." What is it that makes so-called modern programming languages higher-level than C?

  1. Basic data structures are easier to work with.
  2. Notice in the vector example that there isn't a need to define a vector type. Grouping three values in parentheses is all that's necessary. Want to associate a difficulty with a level file? "('castle.lev', easy)" will do it. Need a binary tree? "(Left, Right)" describes the general "shape" of a tree, where Left and Right can each either be another tree or a leaf value. Things that would have been a pain are suddenly trivial.

  3. The compiler doesn't need as much hand-holding.
  4. In the expression "x + 1.2" there's no need to declare the type of x, because it's obvious from context that it must be a floating point value in order to have 1.2 added to it. If you later use x in an inconsistent manner, the compiler will complain. Notation can be a lot more mathematical, instead of being bulked up with excessive punctuation and typing.

  5. Polymorphism.
  6. Code that knows about the shape of a binary tree can operate on trees containing vectors, trees containing strings, and trees containing integers. This is much like the template feature of C++, except that you don't need any extra fussing or syntax. One search routine, for example, can be used in a variety of situations. Bottom line: you write less code.

  7. More advanced concepts built-in.
  8. Imagine passing a point to a routine and having it return a function that moves a creature one step toward that point. This is pretty bizarre sounding, but that's because it isn't in the usual C++ toolbox. "Programming languages teach you not to want what they cannot provide," says Paul Graham in ANSI Common Lisp.

  9. Safety.
  10. It isn't possible to have wild pointers or to overrun array bounds. You can't accidentally overwrite memory. In Lisp, it isn't even possible to increment a value and have it overflow; you can add 10 billion to 10 billion — without using floating point arithmetic — and get a valid answer.

  11. Interactivity.
  12. A tremendous amount of work has gone into writing C debuggers, but the seemingly- unachievable goal is to code up a function and then immediately test it interactively. This is the norm in many other programming languages. As a step in this direction, Visual C++'s "edit and continue" feature is a technical marvel, letting you skip a recompile in certain situations. Lisp systems have been able to do this in an unrestricted manner since the 1960s.


The Tale of An Abused Bandicoot


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2003 CMP Media LLC

privacy policy
| terms of service