Why C++ Is a Funny Name, in an Abstract, Intellectual Kind of Way

The name C++ comes from a nerdy computer thing. So, for all you non-nerdy people out there, I guess I’d better explain a bit first.

Deep down inside, computers are dumb machines. They can only do the simplest of mathematical operations, which basically means addition and Boolean logic. They can’t even multiply. (Or subtract, for that matter, but there’s a way to get around that using addition.) So, in order to get a computer to do anything even remotely complicated, you have to give it a whole long sequence of instructions to perform. But thinking at the computer’s level is overwhelmingly tedious, not to mention error-prone, since it has to do everything in such tiny, simplistic steps. So people invented programming languages to, in programming terms, “abstract” the computer’s lowest operations. This means that programming languages provide an interface for programmers to use to interact with the computer’s hardware, while leaving what the hardware actually does hidden. The code written by a programmer is translated into machine instructions by another program called a compiler that reads the code and generates the corresponding instructions.

Since programming languages are made to be a medium between how the programmer thinks and how the computer thinks, many programming languages try to make their syntax fairly close to normal writing conventions. So the vast majority of programming languages have these things called operators. Operators are signs that represent ways of combining or changing things, like adding or subtracting numbers. They allow programmers to represent the math that they need the computer to do in the same way they write math normally. So 1+1 in a programming language means the same thing as 1+1 in Human Land, all thanks to the good ol’ + operator, which instructs the computer to add the numbers on either side of it. (One notable exception is Lisp, which sacrifices familiarity in favor of pure awesomeness and therefore dispenses with operators and all the syntactic complication they create. In Lisp, 1+1 is written (+ 1 1). Here, + is not an operator; operators generally constitute their own syntactic category in programming languages, but + in Lisp is an instance of a data type called a symbol. Yes, you read that right. The + is data, too. The fact that the program itself is data in Lisp is a big part of what makes it awesome. But that’s a topic for another time.) Now, a computer never remembers anything unless you explicitly tell it to. You know, because it’s stupid. And when you tell the computer to keep track of a given datum, it stores that datum in a variable. Of course, oftentimes the data you tell a computer to keep track of changes over time (hence the name “variable”), so there are operators to change the values of variables. The most basic one is the assignment operator, which generally looks like = or sometimes :=. Note that this is not the same as the mathematical =. In math, = makes a factual statement that two quantities are the same. In programming, =, when used as an assignment operator, instructs the computer to change the contents of the variable on the left hand side to the value on the right hand side. So, in C, int x=1; means “Let x be a variable that holds integers, and let it be assigned the value 1.” The semicolon is there because every instruction in C (and in all the languages derived from it) has to end with a semicolon. And before you ask, yes, it is, in fact, a pain when you forget to put a semicolon. I still remember the first time I made that mistake. It took forever to figure it out. But I digress.

The name C++ comes from an operator in C. ++ in C is the incrementation operator; it assigns the value of 1 + a variable to that variable. So, if x = 1, then x++; changes x to 2. The name C++ is supposed to imply that C++ is C + 1.

Now, every operator, as far as I know, has a return value. Return values work just like simplifications in math: an operator generates a value, which can then replace the original expression involving the operator. So, 1+1, for example, returns 2; that means that whenever you (or a computer compiling a program, as the case may be) have to evaluate 1+1, you replace the expression 1+1 with 2. Thus, if you write int x=1+1; then the 1+1 is processed, returning 2, and the expression becomes int x=2; . Now, the ++ operator, like every other operator, returns a value, but the way it does so is somewhat unusual. The ++ operator returns a different value depending on whether you write it before or after the variable you want to change. ++x returns the new value of x after incrementation, while x++ returns the old value of x before incrementation. Either way, x is incremented, so if x = 1, then either x++ or ++x will make x become 2. The difference becomes visible when you use an incrementation within another expression. For example, again pretending x = 1, if we write int y = ++x; in a program, x will become 2, 2 will be returned, and the expression becomes int y=2; thus assigning the value 2 to y. So both x and y end up becoming 2. But if we write int y = x++; then x will become 2, but x++ will return x’s old value, 1, and the expression becomes int y=1;. So x becomes 2, while y becomes 1. Both versions update the variable contents to 1 more than its original value, but the expression as a whole returns either the original value or the new value depending on the position of the operator.

So now we know enough to see the irony in the name C++. C++ has the incrementation operator written after the variable C. So C is incremented, and meanwhile, the expression C++ as a whole is equal to C’s old value. So C has advanced a step, but the whole expression C++ is worth what C was before it advanced. Which means that, since C is now one more than it was before, the expression C++ is actually worth 1 less than C.

That’s why, if I ever made yet another C-based language, and if I had to use the incrementation operator in its name, I would call it ++C. But even that doesn’t really make sense, because it implies that I’m changing C, when I’m not really doing anything to C, I’m actually making up another language entirely. Really, the most sensible name would be, well, C + 1. The moral of this story: Don’t try to be clever.

You know what, I wish there weren’t so many clone languages of C. A bunch of languages that are all alike is always depressing, whether in programming or in speech. Anyways, plain old C is good enough for me. And also Lisp, of course. Recursion and lexical closures are always fun.

Now, if you’ll excuse me, I’m going to go make up a language called (+ 1 lisp).

More Linguistic Stuff: Topic and Focus

Suppose you were listening in on someone’s conversation and you heard this:
Q: When did you eat the tuna?
A: Yesterday, I ate the tuna.

Doesn’t something just seem off about the answer? It seems like it would sound better if he said, “I ate the tuna yesterday,” with the adverb at the end instead of the start. But it’s the same words either way, so why does it matter? The problem is that in the answer as it is, the topic and focus are switched.

The topic of a sentence is, put simply, what the sentence is about. But of course, it wouldn’t be much use to have a sentence about something that the listener doesn’t know anything about in the first place, because then the listener would have nothing to relate the sentence to and the new information would have no use for him. So, for a sentence to be useful, there’s also an additional requirement that the topic of a sentence has to be something that both the listener and the speaker are already aware of. The focus of a sentence is the new information provided by the sentence. Take the last sentence of the paragraph before this one, for example: “The problem is that in the answer as it is, the topic and focus are switched.” Here, the topic is “the problem”; the fact that there is a problem was already made clear earlier in the paragraph, so this sentence takes that known fact and expounds upon it. The focus is, “that the topic and focus are switched.” This takes the idea of the problem and provides new information about it, saying exactly what the problem is. Focuses could range from a single word to pretty much everything in the clause besides the topic. You might have been taught in school that a sentence consists of a subject and a predicate, where the subject is what the sentence is about and the predicate is everything else. But “subject” really refers to the syntactic construction that’s ordinarily used for indicating the doer of an action; the topic is what the sentence is about. In fact, I think the reason people think in terms of subject and predicate is because English is a subject-prominent language, meaning that the subject is ordinarily assumed to be the topic by default. Although even in English there can be sentences with topics other than the subject. The alternative to subject-prominence is topic-prominence. Topic-prominent languages present a sentence in terms of topic-comment rather than subject-predicate. Japanese, for example, even has a separate word for indicating the topic of a sentence. One archetypal example of a Japanese sentence where the subject isn’t the topic is, “象は鼻が長い” zō-wa hana-ga nagai. The most idiomatic English translation would be, “Elephants have long noses,” but what’s really going on in the original sentence is more like, “Elephant [topic-marker], nose is long”; when people try to teach Japanese to English-speakers, they ordinarily try to emphasize that structure by translating it as, “As for elephants, their noses are long,” or “Speaking of elephants, their noses are long.” The problem with that approach is that the topic marker is used more often in Japanese than phrases like “as for…” or “speaking of…” in English. Really, there’s no perfect way to render a sentence like that idiomatically in English while still maintaining the original Japanese sentence structure; the languages are just too different. But that’s the sort of thing that makes languages interesting, I think.

Anyways, topics generally like to come at the beginning of a sentence. Focuses come later and usually get the strongest accent in the sentence. (No, I don’t mean that if someone is talking with a Southern accent, he’ll say the focus with his r’s curled back even farther than usual. I mean accent as in emphasis.) I’m pretty sure these trends are common across many if not all languages, not just English. I mentioned that English has ways of making something other than the subject the topic; generally, you do that by putting it at the beginning of the sentence. This is why the question and answer at the start of this post sounded wrong. The person who’s asking the question asks when the other person ate the tuna; he already knows that the other guy ate the tuna, he just wants to know when. But the answer, “Yesterday, I ate the tuna,” puts “yesterday” at the beginning, in topic position, and “I ate the tuna” later, in focus position. So he’s talking about yesterday, which is confusing enough because the questioner doesn’t know yet how yesterday is relevant to the question at hand, and then presenting as new information what the questioner already knew. Instead, he should put “yesterday” at the end of the sentence and stress it to make it the focus.

Questions are a special case. In a question, the focus, the new information, of the sentence is unknown; that’s the whole point of the question. So, in questions, the focus is replaced by a placeholder word (“who,” “what,” “where”), and the rest of the sentence is topical information. A good way to figure out what the main focus of a sentence is is to think, “If I were to say this in response to a question, what would the question have to be?” Of course, there could be multiple answers depending on where the stress is. For example, “I ate the tuna yesterday” could be said in response to either “What did you eat yesterday?” (“I ate the tuna yesterday”) or “When did you eat the tuna?” (“I ate the tuna yesterday“), because both “tuna” and “yesterday” come at the end of the sentence, where they can be construed as focuses. It’s the stress that indicates once and for all which is the main focus. One funny thing about English―well, I don’t know, maybe other languages do this too. But one thing that’s funny at least about English is that in questions, the topic and focus seem to completely switch places―so all of a sudden the focus comes at the beginning of the sentence, and the topic gets the strongest stress. I find, for example, that when I ask a question like “What did you eat yesterday?” the stress naturally seems to fall on “eat,” even though technically the focus is “what,” and “did you eat yesterday” (i.e. “you ate yesterday” in question mode) is topical information. Or, if I’m asking specifically about yesterday (notice that word “about”; in other words, yesterday=topic) as opposed to any other time, the stress naturally falls on “yesterday.” I’m pretty sure Japanese doesn’t do this; from what I’ve heard, in Japanese, the question-word seems to get the strongest accent. Although I’m not exactly fluent, so don’t take that as an eternal truth. But it makes sense because the question-word represents the focus. Also, since the topic indicates what specifically someone is asking about, which is kind of important for making sense of the question, English needs to have some way of indicating the topic in questions; so it commandeers the stress from the focus. But with Japanese, since there’s a built-in method of indicating topics, there’s no need to invert the focus-accenting rule. One funny thing about Japanese (funny from an English perspective, anyway) is that syntactically, questions are really treated exactly like declarative sentences, with no special word order or anything, so that a question like “どうすればいいでしょ?” (“If I do what it will probably be good?”) is perfectly normal.

My Personal Theory on Topic-Prominence

I was walking around between classes a few weeks ago, when I noticed something that struck me as pretty interesting…

topic:focus::head:dependent

The topic provides the “main” idea of the sentence, while the focus expounds on it. Similarly, the head in a dependency provides the “main” idea, while the dependent clarifies and modifies it. The dependent is to the head as the focus is to the topic.

So, that got me thinking. Ordinarily, dependency grammar says that the verb is the highest word in the dependency hierarchy. But maybe that only applies to subject-prominent languages. Maybe in topic-prominent languages, the highest word in the dependency hierarchy is actually the topic, and the main verb depends on it. Maybe “topic-prominence” is actually something more like “object-orientation”; in other words, the speakers of topic-prominent languages actually think more in terms of things than in terms of predicates.

But that’s just the personal little theory of an upstart college freshman who hasn’t even taken any classes in linguistics. And I don’t know how you’d test a hypothesis like that anyway.

Why I Like Digimon Better than Pokemon (as far as the shows are concerned)

Right now, I have another post on linguistics and one on Aristotle in progress, but every time I open up my drafts to edit, I find something else I want to change. So then I thought of this, and I thought, “That sounds easy to write. Sure, why not?” I’m beginning to think maybe I should just post my drafts despite all the stuff I want to change. Maybe the problem is that I’m feeling too self-conscious because this is my first time posting my writing on the internet, in which case hopefully putting this up will make it easier to make other posts. So, sooner or later, I’m going to have a post on more linguistic stuff, as well as some stuff about Aristotle, along with whatever other stuff I feel like writing about. My next scholarly subject after Aristotle will probably be calculus.

But for now: The reason I thought of this is that recently, my brother told me that he’d tried re-watching the first episode of Digimon (I think he was referring to the first season), causing him to have one of those “How on earth did I like this as a kid?” moments. So that got me thinking about Digimon.

For  a long time now, I’ve thought that Digimon was much better than Pokemon. Don’t get me wrong; I do like Pokemon. Pokemon is a great franchise, but its strength isn’t in the show, it’s in the games. There’s a good reason why Pokemon is one of Nintendo’s biggest series. It’s a deep, interesting, and very strategic game. It very elegantly solves what I think are the two biggest problems of traditional turn-based RPG’s: 1. You don’t have to take your opponent’s actions into account when deciding your move; no matter what your opponent does, you always tell your fighter to use melee attacks, your wizard to use magic attacks, your cleric to heal, and your thief to steal. (Hey, that rhymed.) Sure, you might take an extra turn or two to use antidotes or something―if your cleric doesn’t already have a status-healing move―or you might have your fighter use potions if you need more than one heal in a turn, but generally you just stick with one pattern. With Pokemon, the fact that your opponent has the chance to swap out his active Pokemon before you can attack, effectively controlling which enemy you target, forces you to try to figure out what your opponent is going to do before you decide your move. 2. Fights are very static. If one side has an advantage, that’s generally going to consist of a higher level, better equipment, or stronger moves―something that can’t really change throughout a fight. So once a fight starts, the winner is already pretty much determined; the advantage never really switches between sides. But with Pokemon, if a player makes one bad prediction, he might lose a strategically important Pokemon, which might allow his opponent to use a previously unavailable tactic, which might lose him the game. Fights have much more potential to change, which makes them much more interesting. (If you don’t get what I mean by these two points, check out this guy’s channel. He does a really good job of showing the strategic element of Pokemon.)

Granted, these advantages arise largely from the fact that Pokemon is primarily a multiplayer game, not a single player game, so even though Pokemon has the same basic turn-based RPG format, you could argue that this is a case of apples and oranges. But then, if you can’t make an interesting single player game, why bother making it?

So, yeah. Pokemon is a great game. The show, on the other hand, is not so great. At least, I think Digimon is better. Which is why it annoys me when people say that Digimon is just a Pokemon rip-off. Even in this blog post editor, “Digimon” is marked as a misspelled word, while “Pokemon” is left unmarked. How outrageous is that?! Digimon was my childhood, man! You can’t mark my childhood as a misspelled word! But, first of all, Digimon originated as a masculine counterpart to the Tamagotchi virtual pet toys. So it had nothing to do with Pokemon. And second, far from being a rip-off, I think Digimon is better than Pokemon. Well, to be fair, I never watched Pokemon very closely. I just had a few episodes on a cassette tape (remember those things?) that I used to watch over and over when I was little. So maybe I can’t make a good comparison. But here’s what I thought Digimon did right:

1. Digimon actually has an ending

Multiple endings, in fact. Like the games in the Final Fantasy series, each season in Digimon is a self-contained story that shares certain common elements, but doesn’t continue off of any previous season. The only exception is season 2 (Digimon Adventure 02), which is also the worst season that I’ve seen. Even in grade school I could barely force myself to sit through the ending, it was so sappy. Although I’ve never watched season 6 (Digimon Fusion), which, from what I’ve seen, looks like the series’s rock bottom. But the point is, each season is a self-contained story, and therefore each one works towards its own conclusion. So by taking this route, Digimon gets the best of both worlds: it can go on forever, but each individual sub-story has a coherent plot with an ending specially designed for it.

Another nice thing about Digimon’s approach to new seasons is that each season introduces a whole new Digital World. So, the world of season 1 (Adventure) is completely different from the world of season 3 (Tamers), which in turn is completely different from the world of season 4 (Frontier), which is completely different from the world of season 5 (Savers). Each season has a whole new geography, history, and mood, on top of the new characters. Not to mention, Digimon isn’t bothered by those awkward questions like, “Why doesn’t the main character get any older?” Actually, there’s no reason why Pokemon couldn’t have benefited from this approach as well. Each generation of Pokemon games introduces a newly designed main character and a new region with new Pokemon. The show has been introducing the new regions and Pokemon by having the same old character they’ve used from the start travel all around the world. But they could easily have used new protagonists, new art styles, new moods, and so on if they had wanted to. Even if they thought it would have been too much trouble to make a new main character from scratch, they could easily have borrowed new protagonists from the games. It’s beyond me why they decided to stick with Ash with his annoying voice and his at worst shallow, at best not particularly interesting motive of becoming the Pokemon master. Well, I guess I can’t relate to that because I’m not particularly competitive; maybe people who are into sports can relate to Ash. But I sure as heck can’t.

Incidentally, while we’re on the subject of comparing seasons, Tamers is the best season of Digimon. It has the darkest story and mood. The second to last scene is actually really frikkin’ melancholic. But I guess they couldn’t bear to end the story on that note, because the last scene is more hopeful.

2. Most importantly: Digimon doesn’t take itself seriously

As I once told my classmates in high school, the difference between Digimon and Pokemon is that if you watch Pokemon again after growing up, you’ll say “This is stupid” and turn it off, but if you watch Digimon again after growing up, you’ll at least get a few little laughs out of it before you say “This is stupid” and turn it off. See, Digimon has a constant atmosphere of flippancy about it. The generic, unimportant characters―you know, man-on-the-street 1 and 2 and all that―are always caricatures with comical voices and lines. The heroes make corny puns at climactic moments. The dialogue generally has the rhythm and feel of witty banter, not the slow, earnest cadence characteristic of most children’s shows. As an example of Digimon humor: In season 1, the following Digimon, Apocalymon, is revealed to be the final villain in the season.

287px-Apokarimon_(Creepy_Mode)_tApocalymon_b

At his big climactic entrance, the camera focuses closely on his face and pans down to reveal the rest of his body. Meanwhile, as the red and blue wires connecting the upper and lower halves of his body come into view, he declares, “I am the ultimate evil… complete with hot and cold running water!”

Later on in the final battle, Apocalymon explains that he originated as the amalgamation of the data of all the Digimon who failed to Digivolve and so were destroyed, their data then being scattered across the Digital World. Therefore, throughout all his existence, he has felt nothing but envy and sadness. And he questions the main characters and their Digimon: “Do you think it’s fair that I have to live in all this agony?! Why should you laugh when I am forced to cry?! Why do you taste the best life has to offer when all I do is choke on its leftovers?! Answer me this!!! Why do you all get the pizza… when I get the crust???!!!!!”

And the dialogue proceeds in this way. The climax ends up being both the tensest and the funniest part of the show. Well, of course, it is a children’s show, so it’s not like Shakespeare or the Marx Brothers or Monty Python or anything, but still.

At another climactic moment, this time in season 2, a villain, Oikawa, is about to scan some data from one of the main characters, Ken. To be exact, he’s going to “harvest” the “dark spore” that’s been implanted in him, whatever that means. The point is, he’s scanning data from Ken using a handheld device, and this is what’s going to allow him to complete his villainous plans. And he tells Ken, “Don’t worry, I promise you won’t feel a thing. It’s just a little data that will be transferred electronically. Just pretend you’re a cereal box… [camera shows Oikawa holding up his scanning device with a menacing look on his face] …and I’m scanning your barcode.”

This is the kind of atmosphere that pervades Digimon.

 

So I think Digimon is a great show in its own right. Not that I’m recommending that you go out and watch it now, of course; it is a children’s show. But I definitely don’t think it deserves to be written off as a copycat of Pokemon.