When students in Florida choose which foreign language to study in high school, they might soon have an unusual choice to make: French, Spanish, or computer code?
The Florida Senate is set to vote Thursday on a bill that would count computer programming classes as foreign language credits in high school graduation and state university admission requirements. The goal is to encourage more students to learn to code.
Florida isn't the first state legislature to consider this: Texas already allows computer science courses to count toward a high school requirement for "languages other than English." Kentucky has considered a bill to count computer programming as a foreign language, as did New Mexico.
Computer science teachers, who'd rather their discipline focus on broad concepts rather than specific languages, think this is a bad idea. But the proposals raise a bigger question: Is a programming language a real "language" at all?
I asked this question of Gretchen McCulloch, a linguist who specializes in how language is used on the internet. McCulloch told me languages and coding are fundamentally different: "Programming is an interface between you and the computer, and a language is a conversation between you and another human being."
But it turns out the way humans communicate with computers can teach us a lot about the layered, complicated ways we communicate with each other. A transcript of my conversation with McCulloch, edited for clarity and length, follows:
Libby Nelson: I want to talk about the assumption underlying these proposals. Is a programming language really a language?
Gretchen McCulloch: Strictly speaking, in terms of what linguists take as an object of study, no. A linguist studies what are referred to as natural languages, which are the languages humans come up with, generally subconsciously.
They contrast that to constructed languages. Constructed languages can include people who are making up languages to be artistic with them, or to look like a natural language but not actually be a natural language — such as the languages J.R.R. Tolkien made up for Lord of the Rings. Programming languages are a subset of constructed languages that are for a specific purpose and don’t have the characteristics of a natural language.
LN: What are those characteristics? What makes a language?
GM: There are couple things natural languages have that programming languages don’t have. One of them is ambiguity.
Formal languages, like logic and programming, are really designed to be as unambiguous as possible, whereas natural languages have ambiguity all over the place. We have synonyms, like boat and ship. We have words that look the same and mean different things, like a baseball bat and the flying mammal bat.
We have structural ambiguity. There’s a classic phrase — "time flies like an arrow, fruit flies like a banana." It looks like it should have parallel structure, but it doesn't. Formal languages don’t want you to do that. People can use context to figure out ambiguity in natural language, where computers aren’t very good at using context.
LN: What else can natural language do that computers can't?
GM: Another characteristic of natural languages that computer languages don’t have is redundancy. So natural languages often say the same thing in several different ways. They are often more verbose — they have more kind of frilly bits around the edges, if you will. (Note: The preceding three phrases are, neatly, an example of what McCulloch is talking about. They express the same idea — spoken language is redundant — in three different ways.)
Natural languages have just kind of evolved, and sometimes they have stuff that is not strictly speaking necessary but lets you understand things better in a crowded room or somewhere where the audio signal isn’t very good. If I misspell a word in a sentence, you can probably still understand what I said. Or if I make a typo, or if a car drives by and I’m talking to you and one of the words gets subsumed into the rumble of the car.
A formal language is designed to not be redundant and designed to be very concise. In a programming language, if you misspell one thing the program has no idea what to do. If you’re writing an "if, then" statement and you write the wrong then — than instead of then — the program has no idea what you’re talking about.
In a sentence, you can write the word "the" twice in a row, and people don't really notice because our eyes just skip over "the." Or switch around the order of the words. A computer has no hope at that.
LN: Does learning a constructed language such as computer programming teach the same skills as learning a natural, spoken language?
GM: If you're a fluent programmer and you’re coding all day, a lot of what you’re spending time on is debugging. People don’t write programs by sitting down and going from point A to point B — that is a misconception people who don’t write programs have. Every good programmer spends most of their time debugging.
If you’re a fluent speaker of Spanish or Japanese, and you’re using that language all day, you’re not spending your time debugging that language. You are actually composing it, having it come out of your mouth. It’s there, and you don’t debug it.
Even a fluent programmer gets partway through something and realizes, "I need to go Google how to do this." If you are a fluent speaker of a language and you’re having a conversation, you can't leave for 10 minutes and Google something. You have to describe it well enough that the people you’re with can help you when you’re using that language in a social situation.
Whereas in programming, you can program with people and you can talk about what you’re doing in your program, but fundamentally programming is an interface between you and the computer. And a language is a conversation between you and another human being.
LN: And maybe it's actually easier to talk to a computer.
GM: Code is actually simpler and less challenging than natural language, if you think about this deeply. People have this impression it’s a heavy, mathematical thing to do, and it’s a job skill, so maybe it’s harder. But I can spend six months at Javascript and I’m fairly good at Javascript; if I’ve spent six months with Spanish, I’m barely a beginner.
As far as teaching machines how to speak languages, it’s taken us decades, literally decades, of trying to teach machines to understand language, and we’ve ended up with something like Siri. And Siri is not as good at language as a 5-year-old is. Many very intelligent adults have spent a heck of a lot of time trying to make Siri, and somehow the unconscious brain of a 5-year-old still does a better job.
I think people underrate how difficult languages are because you’ve forgotten how you learned one. It's much easier to teach a computer to play chess than it is to speak a language. The more math-y the thing you're trying to get the computer to do, the easier it is to do.
LN: It feels like it's the other way around with humans — that we assume the more math-based something is, the harder it is to learn. Is it a problem, then, to talk about computer programming languages as "languages" at all?
GM: I don’t think it’s completely meaningless to talk about language as a cover term that can mean a lot of these things, but we do conflate a number of different things when we mean language.
People conflate "language" as any means of communicating with language as a particular set of natural languages that have all the fully fledged features of natural language. We use the term "body language" — body language is not equivalent to English or French or something like that. If you’ve ever played charades, you know body language is not as good.
Despite the fact that body language can tell you a lot about somebody’s emotional state, it’s not equivalent to language. That’s just not the case.
LN: Is there ever a point where programming languages would start to be more like natural languages?
GM: At some level, the types of instructions you give to a computer are just different from the type of instructions you give to a human. There’s a couple of games to teach code to very young children — it’s about giving instructions to people and having people follow instructions rotely and routinely.
That’s not how our social situations work most of the time. There's a reason you have to be taught to think in code. In reality, we bring a lot of layers to our social situations computers are not good at.
There’s a really fun example: One person says, "Would you like some coffee?" and the other says, "Coffee would keep me awake."
Depending on the time of day, that’s either a yes or a no. If it’s in the morning, or the person looks tired, or you need to pull an all-nighter, or a bunch of contextual cues that indicate being kept awake is a desirable thing, then the person is saying yes. If it’s evening or you know the person wants to be sleeping soon, that’s the person saying no.
I don’t think you could make a computer that would throw in everything it knows about the environment and be able to make a reasonably accurate prediction there. There’s a lot you can do with language that is more subtle.