Blog Articles 126–130

Asimov and Politics (and some terrorism)

This last weekend, I read Asimov’s story ‘The Martian Way’, published in Robot Dreams. The story tells the early beginnings of humanity’s extraterrestrial expansion, the beginnings of what will later be the Spacers in Asimov’s mythos (either that, or the post-Spacer expansion, but I think it’s the Spacer expansion).

The Martian colony is facing opposition from an Earth politician, drumming up opposition to what he is casting as ‘waste’ and casting (or encouraging others to cast) irrational blame on the Mars program for all manner of Earth ills, from farm droughts to the price of aluminum. In typical style, Asimov captures something key about the workings of human societal and political systems:

Digby smiled sourly. ’Politics isn’t pleasant to explain. Hilder introduced this bill to set up a committee to investigate waste in space flight. Maybe three-fourths or more of the General Assembly was against such an investigation as an intolerable and useless extension of bureaucracy—which it is. But how could any legislator be against a mere investigation of waste? It would sound as he had something to fear or to conceal. It would sound as though he were himself profiting from waste. Hilder is not afraid of making such accusations, and whether true or not, they would be a powerful factor with the voters in the next election. The bill passed.

‘And then there came the question of appointing the members of the committee. Those who were against Hilder shied away from membership, which would have meant decisions that would be continually embarassing. Remaining on the sidelines would make that one much less a target for Hilder. The result is that I am the only member of the committee who is outspokenly anti-Hilder and it may cost me re-election.’

Substitute space travel for anything else with an easy villain and appeals to emotion and security, and it’s a pretty good explanation of how reason and clear-sighted investigation can get sidelined. No one wants to appear soft on crime, so the quantity and degree of criminalization of activity climbs. No one wants to be weak in the face of terrorism, so we get the Patriot Act, FISA, the defense authorization bill, etc. A few bold lawmakers speak up and involve themselves against its excesses (and to them I tip my hat), but the majority sit by and vote safely against civil liberty, rule of law, and separation of powers.

Words are fun

I’ve seen a couple of interesting posts about particularly expressive words in non-English languages and cultures lately. First 10 Essential Yiddish Words for Computer Scientists, which has the brilliant bonus word farpotshket (meaning ‘broken, because someone tried to fix it’); then the more general The Many Emotions for which English Has No Words, including the gem pena ajena (basically the opposite of schadenfreude).

Words are fun.

Update: a friend looked in to the provenance of farpotshket, and it sadly doesn’t check out in Yiddish dictionaries.

Aaron Swartz on the news

But finally, I’d like to argue that following the news isn’t just a waste of time, it’s actively unhealthy. Edward Tufte notes that when he used to read the New York Times in the morning, it scrambled his brain with so many different topics that he couldn’t get any real intellectual work done the rest of the day.

The news’s obsession with having a little bit of information on a wide variety of subjects means that it actually gets most of those subjects wrong. (One need only read the blatant errors reported in the corrections page to get some sense of the more thorough-going errors that must lie beneath them. And, indeed, anyone who has ever been in the news will tell you that the news always gets the story wrong.) Its obsession with the criminal and the deviant makes us less trusting people. Its obsession with the hurry of the day-to-day makes us less reflective thinkers. Its obsession with surfaces makes us shallow.

Aaron Swartz on the news. FWIW, C.S. Lewis also didn’t care much for news.

Using Scala path-dependent types for awesome

Scala’s path-dependent types allow objects to carry types along with them, and these types can be used in type-checking. This is useful in all sorts of cases; in particular, it lets you encode relationships where you get objects from another object (e.g. database cursors from a connection), and they objects can only be used with the particular object they came from. You can’t use a cursor with a different connection, even if the connection is an instance of the same class. Path-dependent types allow this requirement to be statically type-checked.

I use these in some of my current research code. I have a spider that makes web requests and saves the results. This spider needs to be able to run against multiple backends, and each backend has a different set of requests and data types. They all have Nodes, but the requests for nodes differ from backend to backend. Abstracting the spider into its own component allows me to quickly write new backends just by specifying the requests with their post-processing/storage capabilities.

The type of a request with its storage (called an InfoNeed) looks something like this:

5 languages for teaching

Rosetta Code is asking for 3-5 languages for teaching orthogonal paradigms. I’ll bite (warning, I’ve spent all of about 15 minutes thinking about this list):

  • Standard ML (or OCaml, if more practicality is desired): functional programming and strong typing, in the simplicity of a H-M type system. Haskell and Scala’s type system extensions are fun, but pedagogically it seems useful to teach in a simpler environment first.
  • Forth, or perhaps Factor: stack-based programming has similar underpinnings to functional programming while feeling wildly different. And preparing the class would be an excuse to more deeply understand Forth. In the historical spirit of Forth, we’d learn it by building it, so some assembly and machine architecture (likely ARM) would be included as well.
  • Java: a “standard” object-oriented language, industrial-strength programming environment. Imperative programming. Design patterns.
  • JavaScript: dynamic language with prototype-based objects. Of the languages I’ve worked with, JavaScript seems to most deeply embody what it means to be a dynamic language without letting you rewrite the language from the inside. There are limitations, to be sure; you can’t make e.g. builder DSLs in it. But at its core, it takes well-worn PL concepts (objects, closures, etc.) and makes them thoroughly dynamic.
  • Oz: declarative programming, dataflow concurrency, and the wonders of having unification as a language primitive.

There are a number of languages I wish I could include (Common Lisp, Haskell, and C, to name a few). This list also has a heavily abstract-programming/virtual machine slant, with the exception of Forth; there isn’t much that runs close to metal, or even exposes the C/POSIX layer very much. That is, I will admit, a weakness. If I were to add a 6th language, it would probably be C or Perl, to get at procedural programming in a Unix-like environment.