Higgledy piggledy

Hello all, I am back from vacation, but rather than get right back into programming language design, let’s have some fun for a Friday.

Most of you are probably familiar with iambic pentameter, which is the poetic meter that Shakespeare wrote in: most lines in Shakespeare are ten syllables, divided up into five iambic feet. Each foot has an unstressed syllable at the beginning and a stressed syllable at the end. As Hamlet says:

O, THAT this TOO too SOlid FLESH would MELT
Thaw AND reSOLVE itSELF inTO a DEW!

Very serious, iambs. Continue reading

Five-dollar words for programmers: elision

Good writers borrow from other writers. Great writers steal from them outright. — Aaron Sorkin

Sorkin was of course stealing outright from T.S. Eliot, who in 1920 wrote:

Immature poets imitate; mature poets steal; bad poets deface what they take, and good poets make it into something better, or at least something different. The good poet welds his theft into a whole of feeling which is unique, utterly different than that from which it is torn; the bad poet throws it into something which has no cohesion. A good poet will usually borrow from authors remote in time, or alien in language, or diverse in interest.

Sorkin’s pithy summary, or a slight modification of it, is often attributed to Pablo Picasso and Oscar Wilde, but I’ve found no reliable evidence that either man ever said anything like it. See this blog post for details.

Computer programmers have a habit of taking jargon from one area of study and borrowing it for use in their own. Today’s five dollar word for programmers is elision; the verb form is to elide. This term from linguistics is used in two non-standard ways by computer programmers.

In natural language linguistics, elisions are the removal of sounds from spoken words that do not change their meaning. Saying

I’m gonna eat my vegtables.

instead of

I am going to eat my vegetables.

elides a great many sounds but does not change the meaning.

A less common usage of the term “elision” in natural linguistics is the omission of entire words. Many of my friends from Pennsylvania, for example, tend to elide the words “to be” from sentences that would require them in the Queen’s English, like “do you have any towels that need washed?”

It is in this sense that computer language designers have borrowed the term: an elision in a programming language is when the language makes optional what might be thought of as a necessary portion of the grammar.

There are a number of legal elisions in C#. For example, the accessibility modifier private may be elided almost everywhere; you can usually remove private from a declaration without changing the meaning of the program. All versions of C# allow you to elide the array bounds and array type in a local variable initializer. These are all the same:

int[] x = { 10, 20, 30 };
int[] x = new int[] { 10, 20, 30 };
int[] x = new int[3] { 10, 20, 30 };

And C# 3.0 and higher also allow

int[] x = new[] { 10, 20, 30 };

I said there were two ways in which computer programmers co-opt the word; the second is in optimization theory. As we just saw in my long series on optimizing lifted arithmetic, the optimizer is allowed to elide conversions if it knows that they are unnecessary: in an expression where an int? is added to an int, by rights we ought to be implicitly converting the non-nullable integer to a nullable integer. But the compiler knows that doing so is a pointless waste of time because the conversion can be removed without changing the meaning of the program. Or, as I described back in 2010, the compiler will sometimes elide the creation of a temporary when initializing a local variable of value type. This form of elision optimization is called copy elision.


Next time on FAIC: Integer arithmetic can be tricky. We’ll try dividing two numbers and see what happens.

Begging the question

Michelle Pfeiffer 2007 In my last post I described the syllogism “Photogenic people look good in photographs; Michelle Pfeiffer is photogenic; therefore, Michelle Pfeiffer looks good in photographs” as “begging the question”. A few people commented on that, so I thought I’d address this point of English usage.

In modern usage, “begging the question” has come to mean nothing more than “the situation suggests that an obvious question to raise at this time is blah blah blah.” For example, “The global financial meltdown begs the question: was there insufficient federal oversight of the American mortgage industry?” Though this usage is certainly common in civic discourse and the media, it is entirely a modern departure from the historic usage of the phrase. I try to eschew this modern usage when I say “begs the question”.

Continue reading