Rethinking programming languages

June 10, 2010

It’s the most dramatic scene of 2001:A Space Odyssey. Dave Bowman floats in space in a tiny pod, outside his ship, returning from rescuing a dead crewmate. As he approaches, he activates his radio.

“HAL.” he says ” try { actuateDoor(PODBAY,OPEN); airlock.cycle();  actuateDoor(PODBAY,CLOSE);airlock.reset();}  catch (Exception e) { radioBroadcast(defaultFrequency, e.getMessage());}”

“I’mSorryDaveButI’mAfraidICan’tDoThatException in line 2019” replies HAL.

Oh wait. That’s not what he says at all. What he says is just “Open the pod bay door, HAL”. And thus lies the difference between real life computers and movie computers.

In a lot of respects though(ignoring the ability to develop murderous tendencies), HAL’s control system makes a lot of sense. Humans are suited to use language, but they are not suited to write computer programs, Even the best computer programmers often spend hours correcting errors that prevent the computer from understanding them properly. Why is this? It boils down to a few reasons:

  • Fault tolerance. Can you understand both what I mean by “sweep”, and what I mean by “sweep();”? A computer programming compiler wouldn’t, because it responds only to a limited set of commands and requires perfect syntax and spelling. surprisingly, one of the most common errors I encounter teaching programming is people forgetting semicolons, or putting them in the wrong places
  • Memory. Programming languages are a pathetic excuse for actual languages, and as a result we have to memorize their commands by rote learning. What’s more, computers are strange things when you get into all the technical details. A competent programmer has to know not only the language, but a whole set of interactions, side-effects, and various arcane details.
  • Cognitive load. Programming requires the programmer to spell out in explicit detail what they want the computer to do. That’s not how we’re used to communicating at all. Even when you give someone a command(i.e.”Open the door”), you’re really not describing actions that you want them to take but rather the final result you want(that the door is open). To do the same thing for say, a robot, would require telling the robot exactly which motors to move to perform every part of the action. Humans just don’t do well with that level of detail, and we make mistakes.

What’s worse, computers are getting vastly more complicated, and with that, the amount of both knowledge and cognitive capacity required to program them is increasing(You know those snazzy Predator drones and SUGV robots? No one person really knows how they work) “So what?” you say “We’ll just find some 1337 h4x0rz to program stuff and I won’t have to worry about it. I’ve never had to program anything before, so it’s not my problem”

The thing is though, unless we want the world to turn into The Humanoids, we need some way to communicate with and control the computers that are rapidly advancing into our daily lives. And, for better or worse, as computers take on more complex duties, that kind of control is going to look increasingly like a programming language. Programming languages are, in essence, the most bare-bones way to express procedures and thought processes.

Thus the current project I’m working on:HAL, or the Heuristic Abstraction Layer. HAL, although not technically a full programming language, is designed to extend Beanshell, a system for running self-modifying Java programs. What HAL does is:

  • Allow commands to be grouped together and executed by either a full set of Beanshell code, of of an infinite possible number of aliases, or a “result” description.
  • “Fuzzy execution” that uses symbolic reduction, stopwords, and parsing certain types of content to accurately execute commands embedded in natural-language phrases
  • Ability to resolve a variety of parameters entered by the user, such the URLs, file paths, adjectives, etc.
  • A “teaching mode” that allows a user to tell the program how to do something either by directly writing Beanshell code or by using already grouped commands. For example, a user could tell a robot to eat a bagel by writing out a complete program or by saying(“Get the bagel out of the freezer, toast it, apply butter, and eat it”, assuming those were all already defined commands.

I’m currently integrating HAl with my Skynet artificial intelligence system. I’d love to hear your thoughts!

Advertisements

One Response to “Rethinking programming languages”

  1. […] Integration with Skynet artificial intelligence system. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: