Blog Articles 121–125

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.

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: